Jump to content

What's wrong with this image?


Recommended Posts

I asked a question on the NI site about an odd difference in images in software that I inherited - http://forums.ni.com/t5/Machine-Vision/What-s-wrong-with-this-image/m-p/3573561#U3573561

I get different images in two versions of a software my predecessor wrote, but I can't get the source code to make my desired image (the first one).  I've attached the Vision Acquisition Express VI that is used in the software on my NI post.  Can you tell me the difference and how I can get the nicer image?

good picture.png  bad picture.png

Link to comment

Often in vision if a picture is analysed then the original is overwritten / destroyed.  Is it just a case of taking the image reference before the processing and then overlaying the analysis result onto the original Image.  Difficult to explain and I do not have the vision toolit to hand.

You often have to copy the original image and use one copy for image processing, then overlay the results onto the original Image, not the processed one.

Edited by CraigC
  • Like 1
Link to comment

I agree with everyone else that the second image looks like a binary image. If this is just coming straight out of the acquisition assistant express VI it might just be how the image indicator is configured to view what's being passed to it. I would try right clicking the image indicator and changing what is selected under the palette options if it is currently set to one of the binary options. If you're working in the vision assistant you'll have to select the color drop down up top to get the same options.

Either way, I would suggest hovering over the images which should tell you the pixel values at the bottom of your window. That will let you know if something in the acquisition has changed or if it is just displaying the images differently for whatever reason.

Link to comment

IIRC most cameras have different acquisition modes (mono, 4-bit, 8-bit and speed and so on) but the properties needed to be set are different per camera.  You can query the modes available via the IMAQ driver and find the one you need, note the index of the mode and then set that mode.  Note that this may be different for each camera type and your predecessor may have set it in code or in MAX.

Link to comment

No-one has stated categorically, so...

The first image is a raw, unadulterated image of the part under inspection with a rake overlaid. Whilst you can take measurements that way, it is very lighting and part specular dependant. To make more repeatable measurements you post process (threshold in this case) to remove noise and make features more defined. The result is a binary image. You then apply the rake to the post-processed image (second of your images).

None of this is camera dependant so changing camera properties does not yield the second image unless it is a smart camera with post-processing (threshold) on board.

So how would you create the first image?

Two ways:

1. Acquire an image and use the Horizontal Clamp to  to make your measurement (it will add the rake overlay).

2. Acquire an image. Make a copy (using the IMAQ Copy Image primitive) then apply a threshold to the copy (there are a couple, one of which I gave earlier) . Next, use the Horizontal Clamp on the copy then copy the Overlay (IMAQ Copy Overlay) onto the original image. This will give you the measurement repeatability of the second image with an output of the first.

Note that operations on IMAQ images are destructive so if you want to keep an image after processing you must make a copy of it before the processing.

Edited by ShaunR
  • Like 1
Link to comment

Shaun makes a good point.  I remember doing that decades ago when there was no RGB processing available.  I did some processing on a mono version of an image but overlayed on a copy of the colour original.  Imemdiately my boss asked me "How on earth did you manage to do that" because he assumed I had done the processing on the RGB image.  He was kind of surprised to hear of what I did.  The human brain automatically correlates the data visible (picture and results) to be a coherent pair even when they are not.

I mean, Trump and President.  Come on. <\joke>

Link to comment
On 1/24/2017 at 10:12 AM, CraigC said:

Often in vision if a picture is analysed then the original is overwritten / destroyed.  Is it just a case of taking the image reference before the processing and then overlaying the analysis result onto the original Image.  Difficult to explain and I do not have the vision toolit to hand.

You often have to copy the original image and use one copy for image processing, then overlay the results onto the original Image, not the processed one.

This should be a bold pop-up for the first 10 times anyone drops a vision VI.  Image wires are references.

  • Like 1
Link to comment
  • 1 month later...
On ‎1‎/‎24‎/‎2017 at 11:12 AM, CraigC said:

Often in vision if a picture is analysed then the original is overwritten / destroyed.  Is it just a case of taking the image reference before the processing and then overlaying the analysis result onto the original Image.  Difficult to explain and I do not have the vision toolit to hand.

You often have to copy the original image and use one copy for image processing, then overlay the results onto the original Image, not the processed one.

This is what solved the issue, I just missed the significance of what you & ShaunR said until after taking an NI Machine Vision course last month.  I still need to overlay the processing parts, but the big nut has been cracked.  Thank you.

visionfix.png

Edited by jcarmody
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.