12-07-2012 08:52 AM
hi guys,
so i'm making this image filter for school in Labview but can't get it to work properly, to do the filtering i'm using a formula node, which in my eyes is easier then with only labview functions.
for the C code i'm following this website: http://lodev.org/cgtutor/filtering.html
i don't copy exact every line, i'm only copying the lines i need. note that i don't use the "ColorRGB" class because it doesn't exist in a formula node, i do the filtering on a black and white image so don't really need it.
I adjusted to code so that it would work in my formula node.
if i run the vi and select the attached image file (can't attach .bmp files so i included a link for the img file) for input then it just returns the original image, which is good and also bad, good because the code works in some way but bad because it doesn't do any filtering or such.
Could anyone please look into this and give me some tips or tell me what i'm doing wrong?
and if anyone knows how to do this in RGB you are always welcome to give me tips. 🙂
used image file: http://www13.zippyshare.com/v/74810991/file.html (can't attach bmp files so i uploaded it quickly)
(btw i know there is this toolkit called vision which has many functions that could help me, but the teacher already said we can't use that)
i hope somebody can assist me in this and willing to give me some help.
Grtz Stino
12-07-2012 09:36 AM
Why don't you use the NI Vision Development Module ?
The filters you use are allready implemented there and I'm pretty sure it will run with better performance.
Christian
12-07-2012 11:59 AM - edited 12-07-2012 12:00 PM
i quote myself: "(btw i know there is this toolkit called vision which has many functions that could help me, but the teacher already said we can't use that)"
we can't use vision because we need to learn about the basics and the principels of DSP, filtering and all of that, so that's why we need to code our own filter, so no vision functions allowed or i fail the class.
12-07-2012 12:43 PM
Take a hard look at your last for loop.
12-08-2012 01:02 PM
ups
12-10-2012 03:52 AM - edited 12-10-2012 03:54 AM
do you mind telling me what mistake i need to look for? 🙂
i looked at my last for loop but can't see the problem, could u please tell me?
and 'ups' what kind of usefull answer is that?
12-10-2012 04:00 AM
omg that was so stupid, i thought my mistake was in the 4 double loop but it was in the very very last loop, ok so i got that fixed but there is still something wrong because the result is mostly a white image or a messed up image? maybe there is something wrong with the math operations but i can't tell, someone have any tips?
12-10-2012 09:22 AM
Yes there are two bugs, I found the other one first but figured if you fixed the result the other would be obvious. This is homework so only a hint:
look at what happens (and does not happen) to pixel.
12-10-2012 10:03 AM
Just one more advice:
Look at the format of the "image" array. The way how to use the values from this array depends on the "image depth" parameter.
In your case, because the image is 8bit, you need to use the "colors" array containing the real RGB value.
Look at the Help for the "Read BMP File VI", you should be able to properly handle your pixels from there.
12-10-2012 12:13 PM
Darin.K wrote:
Yes there are two bugs, I found the other one first but figured if you fixed the result the other would be obvious. This is homework so only a hint:
look at what happens (and does not happen) to pixel.
the first bug was that i had to use the 'result[][]' array instead of the 'image[][]' array in my last loop, right?
the 2nd bug I really can't find :s been lookin at it for almost an hour now and trying new stuff but nothing works,
first i thought i had to put this line " result[x][y] = min(max(int((factor2 * pixel) + bias2), 0), 255);" inside the for loop above but that didn't fix my problem,
maybe the problem is in my 'imageX' and 'imageY' variable, i don't know? any more tips?
I'm sorry for being such a newb but programming isn't my strongest quality.
cedhoc wrote:
Just one more advice:
Look at the format of the "image" array. The way how to use the values from this array depends on the "image depth" parameter.
In your case, because the image is 8bit, you need to use the "colors" array containing the real RGB value.
Look at the Help for the "Read BMP File VI", you should be able to properly handle your pixels from there.