Thread Subject: Extracting overlay pixel from a image

Subject: Extracting overlay pixel from a image

From: Prabhakaran

Date: 30 Oct, 2009 06:24:11

Message: 1 of 7

Hi.. I am doing project on OCR. In that i want to extract only the overlaid pixel from the source. So please help me to extract the overlay pixel from an image.
At present i have detected text in the image but in that scene text is also included.
So please help me in extracting only the overlay text.

Subject: Extracting overlay pixel from a image

From: ImageAnalyst

Date: 30 Oct, 2009 10:16:04

Message: 2 of 7

On Oct 30, 2:24 am, "Prabhakaran " <sathya.w...@gmail.com> wrote:
> Hi.. I am doing project on OCR. In that i want to extract only the overlaid pixel from the source. So please help me to extract the overlay pixel from an image.
> At present i have detected text in the image but in that scene text is also included.
> So please help me in extracting only the overlay text.

------------------------------------------------------------------------------------
Please define "overlaid."

Also it sounds like you have your text somehow (some kind of
segmentation algorithm such as thresholding), so exactly what does " i
have detected text in the image but in that scene text is also
included" mean? You want text. You detected, found and have the
text. So what's the problem?

Where's your image? What's the URL?

Subject: Extracting overlay pixel from a image

From: Prabhakaran

Date: 31 Oct, 2009 06:07:02

Message: 3 of 7

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <e05b3c8e-e4c2-458a-a206-a0e9bcf64150@d10g2000yqh.googlegroups.com>...
> On Oct 30, 2:24?am, "Prabhakaran " <sathya.w...@gmail.com> wrote:
> > Hi.. I am doing project on OCR. In that i want to extract only the overlaid pixel from the source. So please help me to extract the overlay pixel from an image.
> > At present i have detected text in the image but in that scene text is also included.
> > So please help me in extracting only the overlay text.
>
> ------------------------------------------------------------------------------------
> Please define "overlaid."
>
> Also it sounds like you have your text somehow (some kind of
> segmentation algorithm such as thresholding), so exactly what does " i
> have detected text in the image but in that scene text is also
> included" mean? You want text. You detected, found and have the
> text. So what's the problem?
>
> Where's your image? What's the URL?

Actually i didn't perform any operation to find the overlay text (embedded text ). I detected the text by means of what you said by some kind of segmentation algorithm and threshold. Overlaid pixel means Overlay pixel.(Embedded text pixel in image will overlay on the actual image. This is based on my observation).

Overlay text is added mechanically by human editor in the video post-processing phase. Examples:- News caption, sports video caption etc
Scene text is the text embedded in real-world scenes and objects. Example:- sign board in highway, numbers on the back of the sports player etc.,
Image links:
Scene Text:
http://www.imageurlhost.com/images/uo1502vvr4r7ti2nkmj.jpg
http://www.imageurlhost.com/images/bpmoasw5n22lrosp15xk.jpg
Overlay Text:
http://www.imageurlhost.com/images/l5fjidt1dwb381eprwp.jpg
http://www.imageurlhost.com/images/9prhw1ofi91n5idz9g3.jpg

I want to extract only the Overlay text.

I came through your HSI example it is good.

Subject: Extracting overlay pixel from a image

From: ImageAnalyst

Date: 31 Oct, 2009 12:17:53

Message: 4 of 7

On Oct 31, 2:07 am, "Prabhakaran " <sathya.w...@gmail.com> wrote:
> ImageAnalyst <imageanal...@mailinator.com> wrote in message <e05b3c8e-e4c2-458a-a206-a0e9bcf64...@d10g2000yqh.googlegroups.com>...
> > On Oct 30, 2:24?am, "Prabhakaran " <sathya.w...@gmail.com> wrote:
> > > Hi.. I am doing project on OCR. In that i want to extract only the overlaid pixel from the source. So please help me to extract the overlay pixel from an image.
> > > At present i have detected text in the image but in that scene text is also included.
> > > So please help me in extracting only the overlay text.
>
> > ---------------------------------------------------------------------------­---------
> > Please define "overlaid."
>
> > Also it sounds like you have your text somehow (some kind of
> > segmentation algorithm such as thresholding), so exactly what does " i
> > have detected text in the image but in that scene text is also
> > included" mean?  You want text.  You detected, found and have the
> > text.  So what's the problem?
>
> > Where's your image?  What's the URL?
>
> Actually i didn't perform any operation to find the overlay text (embedded text ). I detected the text by means of what you said by some kind of segmentation algorithm and threshold. Overlaid pixel means Overlay pixel.(Embedded text pixel in image will overlay on the actual image. This is based on my observation).
>
> Overlay text is added mechanically by human editor in the video post-processing phase. Examples:- News caption, sports video caption etc
> Scene text is the text embedded in real-world scenes and objects. Example:- sign board in highway, numbers on the back of the sports player etc.,
> Image links:
> Scene Text:http://www.imageurlhost.com/images/uo1502vvr4r7ti2nkmj.jpghttp://www.imageurlhost.com/images/bpmoasw5n22lrosp15xk.jpg
> Overlay Text:http://www.imageurlhost.com/images/l5fjidt1dwb381eprwp.jpghttp://www.imageurlhost.com/images/9prhw1ofi91n5idz9g3.jpg
>
> I want to extract only the Overlay text.
>
> I came through your HSI example it is good.  -
----------------------------------------------------------------------------------------------------------------------------
You seem to be locating the lines of the image that contain text
somehow. From the examples you gave, it looks like the text in the
scene has a uniform background (because it's probably on a sign)
whereas the text that was overlaid later onto a scene does not have a
uniform background. I would try to crop the "text bands" in the
horizontal direction better and then look at the standard deviation of
the region. It would be even better if you could somehow threshold
out the text so that you looked just at the non-text pixels in the
region. Then take the stadnard deviation and say if it's less than
some value it must be "scene text" (e.g. on a sign) whereas it the
stddev is more than a certain value then the text is overlaid on the
scene. Of course you know that there are cases where you overlay text
onto a uniform scene wehre you won't be able to tell if it's text on a
sign in the scene or text overlaid on a uniform part of the scene.
But I think checking the surrounding background of the text is the
best you can do.
Good luck,
ImageAnalyst

Subject: Extracting overlay pixel from a image

From: Prabhakaran

Date: 2 Nov, 2009 04:05:19

Message: 5 of 7

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <8db57054-5fad-4f66-a0d4-34642c23b8ea@t2g2000yqn.googlegroups.com>...
> On Oct 31, 2:07?am, "Prabhakaran " <sathya.w...@gmail.com> wrote:
> > ImageAnalyst <imageanal...@mailinator.com> wrote in message <e05b3c8e-e4c2-458a-a206-a0e9bcf64...@d10g2000yqh.googlegroups.com>...
> > > On Oct 30, 2:24?am, "Prabhakaran " <sathya.w...@gmail.com> wrote:
> > > > Hi.. I am doing project on OCR. In that i want to extract only the overlaid pixel from the source. So please help me to extract the overlay pixel from an image.
> > > > At present i have detected text in the image but in that scene text is also included.
> > > > So please help me in extracting only the overlay text.
> >
> > > ---------------------------------------------------------------------------?---------
> > > Please define "overlaid."
> >
> > > Also it sounds like you have your text somehow (some kind of
> > > segmentation algorithm such as thresholding), so exactly what does " i
> > > have detected text in the image but in that scene text is also
> > > included" mean? ?You want text. ?You detected, found and have the
> > > text. ?So what's the problem?
> >
> > > Where's your image? ?What's the URL?
> >
> > Actually i didn't perform any operation to find the overlay text (embedded text ). I detected the text by means of what you said by some kind of segmentation algorithm and threshold. Overlaid pixel means Overlay pixel.(Embedded text pixel in image will overlay on the actual image. This is based on my observation).
> >
> > Overlay text is added mechanically by human editor in the video post-processing phase. Examples:- News caption, sports video caption etc
> > Scene text is the text embedded in real-world scenes and objects. Example:- sign board in highway, numbers on the back of the sports player etc.,
> > Image links:
> > Scene Text:http://www.imageurlhost.com/images/uo1502vvr4r7ti2nkmj.jpghttp://www.imageurlhost.com/images/bpmoasw5n22lrosp15xk.jpg
> > Overlay Text:http://www.imageurlhost.com/images/l5fjidt1dwb381eprwp.jpghttp://www.imageurlhost.com/images/9prhw1ofi91n5idz9g3.jpg
> >
> > I want to extract only the Overlay text.
> >
> > I came through your HSI example it is good. ?-
> ----------------------------------------------------------------------------------------------------------------------------
> You seem to be locating the lines of the image that contain text
> somehow. From the examples you gave, it looks like the text in the
> scene has a uniform background (because it's probably on a sign)
> whereas the text that was overlaid later onto a scene does not have a
> uniform background. I would try to crop the "text bands" in the
> horizontal direction better and then look at the standard deviation of
> the region. It would be even better if you could somehow threshold
> out the text so that you looked just at the non-text pixels in the
> region. Then take the stadnard deviation and say if it's less than
> some value it must be "scene text" (e.g. on a sign) whereas it the
> stddev is more than a certain value then the text is overlaid on the
> scene. Of course you know that there are cases where you overlay text
> onto a uniform scene wehre you won't be able to tell if it's text on a
> sign in the scene or text overlaid on a uniform part of the scene.
> But I think checking the surrounding background of the text is the
> best you can do.
> Good luck,
> ImageAnalyst

Thank you.. Since i am a beginner i understand only the concept, i could not implement that. Please let me have the implementation of what you said.

Subject: Extracting overlay pixel from a image

From: ImageAnalyst

Date: 2 Nov, 2009 13:06:44

Message: 6 of 7

On Nov 1, 11:05 pm, "Prabhakaran " <sathya.w...@gmail.com> wrote:
> Thank you.. Since i am a beginner i understand only the concept, i could not implement that. Please let me have the implementation of what you said.- ---------------------------------------------------------------------------------------------------------------------

Prabhakaran :
You apparently already know the limits of your region - the starting
and ending rows. Then you just do something like (untested)
stdDev = std(imageArray(row1:row2, col1:col2));
if stdDev > signSceneThresholdValue
  % Text is over the natural scenery, such as over trees or bushes.
else
  % Text is overlaid on a uniform background, such as on a sign.
end

You will need to check stdDev for lots of different images to find out
what signSceneThresholdValue should be. You'll observe low values for
signs and higher values for natural scenery. You need to pick a
threshold value in between those two sets.
Regards,
ImageAnalyst

Subject: Extracting overlay pixel from a image

From: Prabhakaran

Date: 6 Nov, 2009 03:37:04

Message: 7 of 7

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <55d97b1c-f0b7-40f0-b423-06af6406a558@k17g2000yqh.googlegroups.com>...
> On Nov 1, 11:05?pm, "Prabhakaran " <sathya.w...@gmail.com> wrote:
> > Thank you.. Since i am a beginner i understand only the concept, i could not implement that. Please let me have the implementation of what you said.- ---------------------------------------------------------------------------------------------------------------------
>
> Prabhakaran :
> You apparently already know the limits of your region - the starting
> and ending rows. Then you just do something like (untested)
> stdDev = std(imageArray(row1:row2, col1:col2));
> if stdDev > signSceneThresholdValue
> % Text is over the natural scenery, such as over trees or bushes.
> else
> % Text is overlaid on a uniform background, such as on a sign.
> end
>
> You will need to check stdDev for lots of different images to find out
> what signSceneThresholdValue should be. You'll observe low values for
> signs and higher values for natural scenery. You need to pick a
> threshold value in between those two sets.
> Regards,
> ImageAnalyst

Sir i tried it but could not differentiate that plz help me. This is the code i have.

clc;
close all;

figure(1);
%%%%%%%%%%%%%%% A: Original Image %%%%%%%%%%%%%%
sprintf('A: Original Image')
A = imread('Frame 0569.jpg','jpg');
O = A;%Original Image
X = A;%result image will be modified by post procesings

A = rgb2gray(A);
A = im2double(A);

%preprocessings : splitmerge or something like that.
% Average = fspecial('average', 5);%just averaging
% A = imfilter(A, Average, 'conv');%just averaging
A=ordfilt2(A,5,ones(3,3));%median filter
subplot(2, 2, 1);imshow(A, [0 1]);title('A: Original Image');
subplot(2, 2, 2);plot(sum(A'))
subplot(2, 2, 3);plot(sum(A))

figure(2);
%%%%%%%%%%%%%%% B: Sobel vertical edge-emphasizing of A %%%%%%%%%%%%%%
sprintf('B: Sobel vertical edge-emphasizing of A')
Sobel = fspecial('sobel');
B = abs(imfilter(A, Sobel', 'conv'));
B = ordfilt2(B,36,ones(6,6));%6 by 6 maximum filter
subplot(2, 2, 1);imshow(B, [0 1]);title('B: Sobel vertical edge-emphasizing filter');
subplot(2, 2, 2);plot(sum(B')); v_histogram=sum(B');
subplot(2, 2, 3);plot(sum(B))

% delete background
threshold = (sum(sum(B'))/prod(size(sum(B')))*140 + max(max(sum(B')))*30)/100;
for i = 1:prod(size(v_histogram))
    if v_histogram(i)<threshold X(i, :, :) = 0;
    end
end
subplot(2, 2, 4);imshow(X);

% generate list of possible text regions
possible_segment=0;
j=1;
for i = 1:prod(size(v_histogram))
    if (v_histogram(i)<threshold) & (possible_segment==1)
        region_list(j, 2) = i;
        possible_segment=0;
        j=j+1;
    elseif (v_histogram(i)>=threshold) & (possible_segment==0)
        region_list(j, 1) = i;
        possible_segment=1;
    end
end
region_list
[numberof_list_elements, j]=size(region_list);

figure(3);
%%%%%%%%%%%%%%% C: Sobel horisontal edge-emphasizing of B %%%%%%%%%%%%%%
sprintf('C: Sobel horisontal edge-emphasizing of B')
Sobel = fspecial('sobel');
for j=1:numberof_list_elements
C = A(region_list(j, 1):region_list(j, 2), :);
C = abs(imfilter(C, Sobel, 'conv'));
C = ordfilt2(C, 20,ones(1, 20));%1 by 20 maximum filter
subplot(numberof_list_elements, 3, (j-1)*3+1);imshow(C, [0 1]);title('C: Sobel horisontal edge-emphasizing');
subplot(numberof_list_elements, 3, (j-1)*3+2);plot(sum(C)); histogram=sum(C);

% delete background
threshold = (sum(sum(C))/prod(size(sum(C)))*50 + min(min(sum(C)))*30)/100;
%threshold = 20;
for i = 1:prod(size(histogram))
if histogram(i)<threshold
            X(region_list(j, 1):region_list(j, 2), i, :) = 0;
end
end

subplot(numberof_list_elements, 3, (j-1)*3+3); imshow(X);

end

% stdDev = std(imageArray(row1:row2, col1:col2));
% if stdDev > signSceneThresholdValue
% % Text is over the natural scenery, such as over trees or bushes.
% else
% % Text is overlaid on a uniform background, such as on a sign.
% end

figure(4);
subplot(3, 1, 1); imshow(O);title('A: Original Image');
subplot(3, 1, 2); imshow(X);title('X: Text segmented image');
subplot(3, 1, 3); imshow(im2bw(X, 0.75));title('X: thresholded image');
%outputFolder = fullfile(cd, 'Frame_JPG');
%outputBaseFileName = sprintf('F%4.4d.jpg', frame);
%outputFullFileName = fullfile(outputFolder, outputBaseFileName);
%imwrite(O);%, outputFullFileName, 'jpg');
%imwrite(X);%, outputFullFileName, 'jpg');
%imwrite(thisFrame, outputFullFileName, 'jpg');

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
ocr Prabhakaran 30 Oct, 2009 02:29:02
text detection ... Prabhakaran 30 Oct, 2009 02:29:02
rssFeed for this Thread

Contact us at files@mathworks.com