![]() |
histogram equalization for medical images
1 Attachment(s)
hi, im currently on a final year project and im doing hist. equalization for medical images. im progressing pretty alright.. so far, i have came up with codes to do this project.
Code: CPP
so this is the code so far and i have commented out the function of each code descriptions.. right now i have write up the code to get the pixel value of the image. so i need to draw lines on the histogram to represent it.. how do i go about doing it? i will attach what its suppose to display until this codes in this thread. thanks for the help in adv! |
Re: histogram equalization for medical images
> 'for' loop to loop through the bytes of the image
OK, one way to check the colour if an individual pixel is to call GetPixel which will return the RGB() value it finds at that point on the screen. So GetPixel(x,y) where (x,y) is black will return RGB(0,0,0). Probably if the image is greyscale then R=G=B but if not you'll need to find some way of computing intensity from three RGB values. However if you prefer to get the data directly from image[] then you'll need to know how image[n] is converted to one or more pixels on the screen, and you can use that to calculate the intensity of the pixel(s) represented by each entry in image[]. Otherwise array1[image[i]]++; (as you already have done) seems a good way to me of increasing the count for each individual intensity value, and the representation for that in the histogram could just be a case of drawing a vertical line that is array1[n] pixels long at x=n, and from the code I can see you already know how to draw a straight line. |
Re: histogram equalization for medical images
hey thanks for replying to my post. so i wanna draw a vertical line for example:
pDC->MoveTo(x,y); pDC->LineTo(x,y); the values of x need to be in referrence with image[i] and y would be in referrence to i? or is it vice versa? |
Re: histogram equalization for medical images
Depends which way round you're drawing it. You could experiment and see which way fits what you had in mind.
If you're drawing a series of horizontal lines, say: Code:
------ |
Re: histogram equalization for medical images
yeah.. i tried it but nothing displays on the graph.. is there any alternative way that i could do to troubleshoot this?
|
Re: histogram equalization for medical images
What is the code in the for loop? It's difficult to determine what's wrong with it if I can't see it.
|
Re: histogram equalization for medical images
ouh which for loop you are talking about? the most recent for loop is to calculate the pixel intensity. so i actually want to draw a line for 'testing' if the code which i wrote ACTUALLY works, or otherwise.
|
Re: histogram equalization for medical images
In your previous post you said "i tried it but nothing displays on the graph". That's the code I'm talking about. You know, the code that doesn't work and that I can't work out what's wrong with it if I can't see it? It might not be in a for loop, there are other ways of looping, but for is the most likely.
|
Re: histogram equalization for medical images
hi thanks for replying. well somehow i have edited the codes over time. i will update to u about it now.
Code:
the code in green and red is the new addition to it and its supposed to draw lines for the number of pixels in respect to its intensity value ie how many pixels has a value of 20. so this code is somewhat 'approved' from my supervisor. the only thing is that, the code line in red needs to be changed. im not too sure what i should input on the position 'Y'. i can try a few errors but i get my app to crash at times. so maybe u can help me on what to replace the Y with. thanks in advance! |
Re: histogram equalization for medical images
Did you try 400-array1[i]?
This may need scaling though if array1[i] ever exceeds 400 (so if array[i] can reach 800, then you'll need to divide by 2 to fit the graph to the screen). What is the range of numbers stored in image256 (ie what are the min and max)? |
| All times are GMT +5.5. The time now is 10:58. |