# Removing unwanted areas using Magic Tool

**URL:** <https://community.pix4d.com/t/removing-unwanted-areas-using-magic-tool/26602>\
**Category:** General Ag Questions/Troubleshooting\
**Created:** [May 30, 2023, 10:32am UTC](https://community.pix4d.com/t/removing-unwanted-areas-using-magic-tool/26602 "2023-05-30T10:32:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lowaltitude](https://avatars.discourse-cdn.com/v4/letter/l/f19dbf/32.png) [@lowaltitude](https://community.pix4d.com/u/lowaltitude)\
**Post date:** [May 30, 2023, 10:32am UTC](https://community.pix4d.com/t/removing-unwanted-areas-using-magic-tool/26602/1 "2023-05-30T10:32:22Z")

</div>

I have flown a multispectral vineyard survey and want to generate indices just on the vine plants themselves. Between the vine rows there is either earth, or grass & weeds. I know I can ‘mask’ the earth using SAVI but it’s difficult to distinguish between the health of vine and the grass.  
I thought I could use the Magic Tool to remove the areas I don’t want values for, leaving the actual vine plants on which I can generate an index.  
However, my theory didn’t work so I must be doing something wrong!  
I selected the Ortho layer and created a boundary. I then ran the magic tool and selected WANTED as the vine plants and UNWANTED as the earth & grass. I then cleaned up and ran the output. I am left with a new annotation called ‘Grass Removed’, but I can’t do anything with it. If I run Indexes, they generate on the whole Ortho, not the filtered one.

Please can you tell me what I am doing wrong?

 ![Screenshot 2023-05-30 at 11.25.35](https://global.discourse-cdn.com/pix4d/original/2X/4/4bcfb6d73037e726f611358e05beb55e9b2b9f17.jpeg)

---

<div class="post-metadata">

**Author:** ![Jose.Arnaudo](https://sea2.discourse-cdn.com/pix4d/user_avatar/community.pix4d.com/jose.arnaudo/32/5966_2.png) [@Jose.Arnaudo](https://community.pix4d.com/u/Jose.Arnaudo)\
**Post date:** [May 30, 2023, 12:39pm UTC](https://community.pix4d.com/t/removing-unwanted-areas-using-magic-tool/26602/2 "2023-05-30T12:39:34Z")

</div>

Hi Chris,

What you obtained is a selection of the pixels with grass. You are correct. This could be useful if you need to apply some treatment only there, for example.

As you mentioned, perhaps masking is what you need, although it can be difficult to differentiate between grass and vine rows. [Soil and plant masking w/ Pix4Dfields](https://community.pix4d.com/t/soil-and-plant-masking-w-pix4dfields/12300)

In our next release happening in June, you will be able to export a grid prescription taking Magic tool outputs too.  
For now, you will need to draw each vine row as a boundary and then trim the layer.

I hope this helps.

José

---

<div class="post-metadata">

**Author:** ![lowaltitude](https://avatars.discourse-cdn.com/v4/letter/l/f19dbf/32.png) [@lowaltitude](https://community.pix4d.com/u/lowaltitude)\
**Post date:** [May 30, 2023, 1:58pm UTC](https://community.pix4d.com/t/removing-unwanted-areas-using-magic-tool/26602/3 "2023-05-30T13:58:33Z")

</div>

Does that mean that ‘WANTED’ actually means ‘these are the things I want to remove’? I assumed it means ‘these are the things I want to keep’!

I think you’re saying the Magic Tool should not be used for this type of task?

Ok, I will try creating multiple boundaries to cover each line of vine (wow that’s a big job!) and then run indices on that.

UPDATE: So I quickly drew 3 boundaries on the Ortho, but could only trim to one? Now I am left with a single strip of vine plants and 2 empty boundaries. How do I draw all the boundaries and then trim to all of them? I expect to see 50+ boundaries each containing a row of plants, on which I can generate an index.

 ![Screenshot 2023-05-30 at 15.05.37](https://global.discourse-cdn.com/pix4d/original/2X/b/b9e4987c05dd7fef67bea832d42a7a1206b59022.jpeg)

 ![Screenshot 2023-05-30 at 15.08.27](https://global.discourse-cdn.com/pix4d/original/2X/6/6dbadb14e0f0b4eab4b1c4d9a91a76dd52e11b36.jpeg)

---

<div class="post-metadata">

**Author:** ![Jose.Arnaudo](https://sea2.discourse-cdn.com/pix4d/user_avatar/community.pix4d.com/jose.arnaudo/32/5966_2.png) [@Jose.Arnaudo](https://community.pix4d.com/u/Jose.Arnaudo)\
**Post date:** [May 30, 2023, 2:24pm UTC](https://community.pix4d.com/t/removing-unwanted-areas-using-magic-tool/26602/4 "2023-05-30T14:24:13Z")

</div>

Regarding Magic tool, _Wanted_ refers to the pixels you want to be selected automatically by the tool. This is always referring to the new grid that is generated and not the original Orthomosaic.

You can create one boundary per field, adding more parts to it using this icon:  
 ![image](https://global.discourse-cdn.com/pix4d/original/2X/8/84a05108f284b8eef54f5ca80389bd1aa3745eb5.png)

This will provide only one boundary file per field.

Let me know if this works for you.

José

---

<div class="post-metadata">

**Author:** ![lowaltitude](https://avatars.discourse-cdn.com/v4/letter/l/f19dbf/32.png) [@lowaltitude](https://community.pix4d.com/u/lowaltitude)\
**Post date:** [May 30, 2023, 3:15pm UTC](https://community.pix4d.com/t/removing-unwanted-areas-using-magic-tool/26602/5 "2023-05-30T15:15:02Z")

</div>

That’s not working: now I get a large rectangular dotted-line box that I can’t move, or this mess:

 ![Screenshot 2023-05-30 at 16.14.40](https://global.discourse-cdn.com/pix4d/original/2X/8/899f55b5177f561443188652767bd0da11cb994a.jpeg)

UPDATE: no, I got it now! But I have to draw each new sub-polygon, I can’y copy/paste the previous?

---

<div class="post-metadata">

**Author:** ![lowaltitude](https://avatars.discourse-cdn.com/v4/letter/l/f19dbf/32.png) [@lowaltitude](https://community.pix4d.com/u/lowaltitude)\
**Post date:** [May 30, 2023, 9:02pm UTC](https://community.pix4d.com/t/removing-unwanted-areas-using-magic-tool/26602/6 "2023-05-30T21:02:54Z")

</div>

Sorry, another question! Now I have created my complex boundary, can I export it and them import on another project? I will survey the same area again in a month and will want to reuse the boundary, so that I can compare the first survey with the second survey.

---

<div class="post-metadata">

**Author:** ![Jose.Arnaudo](https://sea2.discourse-cdn.com/pix4d/user_avatar/community.pix4d.com/jose.arnaudo/32/5966_2.png) [@Jose.Arnaudo](https://community.pix4d.com/u/Jose.Arnaudo)\
**Post date:** [May 31, 2023, 8:54am UTC](https://community.pix4d.com/t/removing-unwanted-areas-using-magic-tool/26602/7 "2023-05-31T08:54:38Z")

</div>

Hi Chris,

Yes, you can always Export going to the Export menu on the top right.

From there export this boundaries to be used later.

José

---

<div class="post-metadata">

**Author:** ![wfisher01](https://avatars.discourse-cdn.com/v4/letter/w/eb8c5e/32.png) [@wfisher01](https://community.pix4d.com/u/wfisher01)\
**Post date:** [September 17, 2024, 1:02am UTC](https://community.pix4d.com/t/removing-unwanted-areas-using-magic-tool/26602/8 "2024-09-17T01:02:41Z")

</div>

Is there any updates to this post? I have a large scale vineyard project and creating individual boundaries is very time consuming.
