How to apply moment preserving to grayscale document image

Hi how to apply moment preserving to grayscale document image to obtain gray values. how to proceed i need a example code.

7 Comments

http://mirror.transact.net.au/pub/sourceforge/s/project/sv/svenlib/src/sven/segmentation/Thresholders.java i have found this java code but how to assing this histo value it give me error double[] histo = new double[MAX_VALUE + 1];
What do you mean by 'moment preserving'?
by applying moment preserving prinicpal for get thresholding to binarize image, like default method for obtain threshold
Nothing is going to happen with your question unless you formulate a proper question. Until then, no one has any clue as to what MATLAB code of yours needs fixing. Please read this tutorial: http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer. Also, read this FAQ: http://matlab.wikia.com/wiki/FAQ#Can_you_program_up_the_algorithm_in_this_article_for_me_and_explain_it_to_me.3F
moment preserving is one of the principal,by applying this principal getting max grayvalues and min gray value from a image. if use normal max and min function it always returns 0,255. for all images . can anyone know about the moment preserving principal and how to apply it in image. if my question is not clear , i will explain again
It is not clear. Please explain it to someone else and have them write it down and paste their explanation back here. Otherwise all I can say is try this:
outputImage = inputImage;
Everything from the input image will be preserved, including ALL moments.
I want to Convert of Input image to Binary form - By Apply moment-preserving threshold (W. H. Tsai, “Moment-Preserving Thresholding:) to input image to obtain two representative gray values g1 and g2, i have to compute threshold value from it , T = (g1 + g2)/2; using the threshold i need to convert it into binary.

Sign in to comment.

Answers (1)

Ah, finally now we're getting somewhere. Moment preserving THRESHOLDING. That thresholding word is important. You really didn't explain the algorithm though. So I have no idea what g1 and g2 are, given some arbitrary gray scale image. And the FAQ applies here.
But let's assume you have them and you calculated a threshold value of T according to your formula. Then you could binarize (threshold) the image into two levels (foreground and background) simply by doing this:
binaryImage = grayImage < T; % Or you can use <=, >, or >= if you want.
This will not preserve ALL moments, but may preserve one or a few of the moments if T was chosen appropriately.

2 Comments

g1,g2 is grey scale values from a image.
Yes, I know that. How about 42 and 213 - will those do? If not, then why not?

Sign in to comment.

Asked:

on 12 Nov 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!