Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to recognize and segment certain area of pork loin picture from VBAI?

Solved!
Go to solution

Hi Every professional experts out there, 

 

I got a big image processing issue worried me about couple months now, please help me with your brilliant idea. 

 

Operating system: Windows 8

NI platform: NI VBAI 2013 SP1

Camera: NI smart camera 17XX

 

Question:  I want using NI Vision Assistant from VBAI separate/segment certain area (yellow line) from pork loin images. But i tried every possible ways i knew, still didn' get a really good result.

  • I tried using color difference to separate the area but some images really don't have huge color difference. 
  • Texture feature would be another good way but i really don't know how to do this in VBAI.
  • I was thinking use a ROI area, like locate the loin image and cut a maximum square box out of the interest area  i want extract, but let would release another issue: how to auto put the box in the area i interested (yellow line)??
  • I've also tried find edge step, but that just give me nothing but length value.

So please someone give me some ideas how to processing these image to get the target area i want.

 

Thank you so much!!

 

 

 

001.jpg002.jpg

 

 

0 Kudos
Message 1 of 10
(5,166 Views)

Do me a favour and post the images without the yellow markers too? 
I have some idea, but I'd like to test it with the source images... Have you considered using LabVIEW vis instead of the VBAI ... which is fairly limited in scope?

 

Birgit

Message 2 of 10
(5,148 Views)

Well we can figure out a way to run .VI in the VBAI right? 

Here is the original picture. 

Thanks 

Rex

MT008.jpg

0 Kudos
Message 3 of 10
(5,143 Views)

Hi Rex,

 

I've thought about this and this is a fairly tough application. The human eye can pretty quickly pick out what you're trying to find, but I think that's based on the change in texture as opposed to an actual edge.

 

My thought goes along on that same pathway - maybe figure out a texture value for different parts of the image, and then convert the image into a binary image based on some threshold to expose the particular area of pork. This VI is the main one of interest for me: IMAQ Extract Texture Feature.

 

The issue with this is defining ROIs small enough to provide the granularity you're looking for, but large enough to actually detect a meaningful texture. Additionally, this means you'd have to pull out the texture for many (100's to 100,000's) ROIs, which would take a lot of processing.

Andrew T.
"His job is to shed light, and not to master" - Robert Hunter
0 Kudos
Message 4 of 10
(5,096 Views)

Hi Andrew,

 

Thanks for reply. 

 

Texture feature might be the first option to extract the area, i agree with you, but that indeed is a farily tough job. 

 

So i have an idea, see i can let the loin direction stay the same, the area i want can keep on the left of the image. 

 

Could we just creat a ROI area based on the size of the loin, and cut out an area which can fall in to the yellow mark. That will work too. 

 

How could we auto dectect the different size of the loin and define a ROI on centain position? could you help me to do that?

 

999.jpg  

0 Kudos
Message 5 of 10
(5,087 Views)
Solution
Accepted by rex678805

Hi Rex,

 

You could do something like this – you could identify edges (not sure if you’d want to find top and bottom edges as well as left and right). Based on the image you uploaded, this should be relatively painless. Once you have these edges, you can determine an approximate size by measuring the distance(s) between them. From this, you can extract some idea of size – whether it be thickness or a rough idea of loin area. You could also use these edges to define a coordinate system, and then define a ROI relative to that system.

 

Is this what you had in mind?

 

Also, do you have any higher definition images you could upload?

 

Andrew T.
"His job is to shed light, and not to master" - Robert Hunter
Message 6 of 10
(5,052 Views)

Hi Andrew,

 

The edges plus Coordinate system define the ROI seems to be the best idea right now. And i tried to setting the steps according your advise, the result shows not really bad. I think i am gonna using this method right now. 

 

So i got one more question, if i extracted some value from the image, now i want sort this image and show the result according this value. For example,

 

  • if value A=3, when A locate at range "1-3", mark and show this image as Lable 1
  • if value A=6, when A locate at range "4-6", mark and show this image as Lable 2.
  • .......

I tried the step Caculator and Custom Overlay, but just couldn't get the result out. 

 

And about the defination images, i took the images using NI smart camera, the image solution is 1500*600, this is the highest solution i can get. 

 

Rex

0 Kudos
Message 7 of 10
(5,036 Views)

Here's a sample inspection in Vision Builder AI 2014 that uses the magic wand feature of the ROI step, with some filtering in the detect object (you can add more filtering if you want to filter on more criteria than just size (i.e. shape of the particle). Then I use some variable (feel free to replace with your method for figuring out the score) to determine a grade and overlay it.

 

Hope this helps,

Brad

0 Kudos
Message 8 of 10
(4,993 Views)

Hi Brad,

 

Thanks for replying and the program.

 

I thought and used magic wand function before, the issue is the loin size are different, and position are different as well. So it usually fit this picture, but not fit for next one (over or less recognize the area).

 

Right now i am using the edge plus coordinate idea to locate the ROI, and works fine, some picture still out of the area, but this way is the best way up to now.   

 

If you have any other idea, please advise and once again, really appreciated it. 

 

Rex

 

 

0 Kudos
Message 9 of 10
(4,946 Views)

u might wan to test with more image with the attached vbai.

edge -> threshold -> particle filer -> morphology 

u can play with numbers in some of the step to get a more consistent output

thxSmiley Happy

 

Capture.PNGmedium.jpg

0 Kudos
Message 10 of 10
(4,685 Views)