LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

applying a Aforge.NET color filter to a bitmap

Solved!
Go to solution

Hi,

 

I've been playing around with the Aforge.Net framework.  Mostly to learn how to use .dll's and play around with a bit of image analysis.  Yes I know labview has image analysis tools but I cant afford them, and this is just for hobby use so not required.

 

Please see code attached: (lots of it comes from the forum posts I've found on this subject, I've just cleaned it up for my own understanding)

 

Specifically, In the state "Process" that is found inside the "Timeout" event. I'm trying to apply the simple blue color filtering from this example (http://www.aforgenet.com/articles/step_to_stereo_vision/) [scroll down to "detecting an object"].  The problem I have is that I just dont understand how to apply this to the image and view it.

 

You can see in the same state (process), that I was also trying to use the image data cluster and somehow convert to the system.drawing.bitmap that the Colorfiltering apply method is asking for.  But I'm lost on that avenue, and I aslo dont see how this would allow me to view the filtered image (it should only show objects that are blue.

 

Any suggestions, tips, or examples would be greately appreciated.  

 

Ultimately my goal is to get through the majority of the aforge example of tracking an object on webcam and retrieving its coordinates, but currently I'm stuck in the mud lol.

0 Kudos
Message 1 of 6
(4,212 Views)

Also thought it might help If I attach a picture for those who cant open code from LV 2013.

0 Kudos
Message 2 of 6
(4,169 Views)

I am not understanding why you feel it is necessary to be complicating your code with a state machine and using event structures.

 

Get your code to do it ONCE.

 

The problem with trying to debug your code is that we would need to install the AForge.NET framework, and I can't do that on my work PC.

0 Kudos
Message 3 of 6
(4,160 Views)
Solution
Accepted by topic author Tim30

Hello,

 

I looks like your output display is not of type .NET, which is making it difficult to view. Try replacing it with a .NET indicator. Your filter logic appears to be correct.

Warm Regards,

Josh
Message 4 of 6
(4,128 Views)

 

@ ChacAttac - Fantastic Thanks! That was easy!.  I basically didnt have any output display, I couldnt figure out what the "Apply" output was supposed to connect to. This makes sense and works.

 

@ nyc - Sorry I thought that the included dll's in the .zip would be enough to point to rather than installing the entire Aforge framework.  I decided to use a state machine because I'm taking this from a learning approach.  Granted, there is a bunch of code that could be put into one initialize routine.  But I did want to be able to turn the cam on and off , take snap shots, apply different filters and play around with the differnt tools in the Aforge.NET framework.  Also for my own understanding of what each element was doing, it was much cleaner and visible for me in one screen as a state machine.  To each their own right :- )  I'd probably change the approach it if I needed it for an actual project.  Cheers.

 

I've posted a screen shot of what I put into my code to make it work.. basically exactly what ChacAttac suggested.  Connect the "Apply" to a picture box property node.  FYI for anyone looking at just the .jpg, the .net target class on the "to more specific class" is System.Drawing.Bitmap

 

Thanks for the help guys.  When I finish more, I'll try to post it here as another example of Aforge.NET in use.  Seems to be pretty powerful if you cant afford the NI vision addons.

0 Kudos
Message 5 of 6
(4,113 Views)

Tim30,

 

I'm happy you are able to move forward now. Good luck with the rest of your exciting project!

Warm Regards,

Josh
0 Kudos
Message 6 of 6
(4,057 Views)