Thread Subject: Scanning Binary Images

Subject: Scanning Binary Images

From: Prasenjeet Patil

Date: 24 Mar, 2009 06:51:04

Message: 1 of 11

Hi there,
I had used 'sobel','vertical' for edge detection.Now, I want to find the nunber of ones in the image, so that I can trim the regions. I dont know the looping method for scanning the image.
Thanks in Advance.

Subject: Scanning Binary Images

From: us

Date: 24 Mar, 2009 09:18:02

Message: 2 of 11

"Prasenjeet Patil"
> I had used 'sobel','vertical' for edge detection.Now, I want to find the nunber of ones in the image, so that I can trim the regions. I dont know the looping method for scanning the image...

it is not clear what you mean by ...the number of ones in the image...

us

Subject: Scanning Binary Images

From: ImageAnalyst

Date: 24 Mar, 2009 10:26:57

Message: 3 of 11

"Prasenjeet Patil"
I'm glad you (sort of) described what you really want to do because I
don't think that "finding" (whatever that means) is what you need to
do. It looks like you want to trim the image. But again, you have
not really described what this is. Do you want to skeletonize the
binary image and then prune it? If so, then look at bwmorph().
There's options in there skeletonization ('skel') and pruning (I
forget what this option is called since they chose some non-standard
name for it).
Regards,
ImageAnalyst

Subject: Scanning Binary Images

From: Prasenjeet Patil

Date: 24 Mar, 2009 13:08:02

Message: 4 of 11

Thanks for reply ,
I want to extract license plate from the binary image.
I had done edge detection & got vertical edges.
Now I want to search for number of ones(in vertical lines ), so that I can trim them.
I dont know how to make a loop so that only one's in the image gets extracted.

Thanks,

Subject: Scanning Binary Images

From: Dave Robinson

Date: 24 Mar, 2009 14:40:19

Message: 5 of 11

"Prasenjeet Patil" <prasenjeet.patil@hotmail.com> wrote in message <gqalvi$gc6$1@fred.mathworks.com>...
> Thanks for reply ,
> I want to extract license plate from the binary image.
> I had done edge detection & got vertical edges.
> Now I want to search for number of ones(in vertical lines ), so that I can trim them.
> I dont know how to make a loop so that only one's in the image gets extracted.
>
> Thanks,

If you just want to count the number of white pixels in your binary image after your edge detect then maybe something like

NumberofWhitePixels = sum(sum(binaryimage));

might do it for you. The black pixels add zero to the sum, whilst the white pixels will increment the sum, hence at the end of the day the total sum will be the number of white pixels in your binary image.

If thats not what you mean, then you had better have another go at explaining your problem.

Regards

Dave Robinson

Subject: Scanning Binary Images

From: ImageAnalyst

Date: 24 Mar, 2009 16:14:58

Message: 6 of 11

On Mar 24, 9:08=A0am, "Prasenjeet Patil" <prasenjeet.pa...@hotmail.com>
wrote:
> Thanks for reply ,
> I want to extract license plate from the binary image.
> I had done edge detection & got vertical edges.
> Now I want to search for number of ones(in vertical lines ), so that I ca=
n trim them.
> I dont know how to make a loop so that only one's in the image gets extra=
cted.
>
> Thanks,

-----------------------------------------------------------
Well there you go again, being vague. If you simply want to count the
number of 1's, then do what Dave says. But, like many people, you're
giving us one small step in the whole project as if you're certain you
know that it's the correct step. So let's step back and ask what you
REALLY want to do. Do you want to crop out the image of the license
plate into another image, and possibly save that to disk? Do you want
to do OCR (optical character recognition) on it so that you're turning
the image into an alphanumeric string that is the letters & numbers on
the plate? And what does trim mean? Do you mean the 'spur' option of
bwmorph (MATLAB's terminology for pruning the skeleton is 'spur' for
some reason)?

And now I just thought of something.... by "ones in the image" do you
mean a value of 1 in a logical image that was gotten by thresholding
an edge detection image, OR ... do you mean actual 1's on the original
image (for example if my license plate is "1D10T5" you would have 2
1's in the image?

By the way, license plate analysis is something that pops up here
frequently along with face detection, fingerprints, etc. so you might
look at Google groups to search for past threads on the topic.

Finally, I'm not sure why you think you need a loop. But if you do, I
hope you know how to construct one in MATLAB - maybe you were just
asking for help on what (i.e., the algorithm) should go inside the
loop.
Regards,
ImageAnalyst

Subject: Scanning Binary Images

From: us

Date: 24 Mar, 2009 16:19:01

Message: 7 of 11

ImageAnalyst
> Well there you go again, being vague.
> And now I just thought of something.... by "ones in the image" do you
> mean a value of 1 in a logical image that was gotten by thresholding
> an edge detection image, OR ... do you mean actual 1's on the original
> image (for example if my license plate is "1D10T5" you would have 2
> 1's in the image...

interestingly enough: 4 replies later (and a lot of precious senior CSSMer time spent) - and we are still at reply #1...

just a thought with a :-)
us

Subject: Scanning Binary Images

From: ImageAnalyst

Date: 24 Mar, 2009 17:30:34

Message: 8 of 11

On Mar 24, 12:19=A0pm, "us " <u...@neurol.unizh.ch> wrote:
> ImageAnalyst
>
> > Well there you go again, being vague. =A0
> > And now I just thought of something.... by "ones in the image" do you
> > mean a value of 1 in a logical image that was gotten by thresholding
> > an edge detection image, OR ... do you mean actual 1's on the original
> > image (for example if my license plate is "1D10T5" you would have 2
> > 1's in the image...
>
> interestingly enough: 4 replies later (and a lot of precious senior CSSMe=
r time spent) - and we are still at reply #1...
>
> just a thought with a :-)
> us

us:
Yes so true. This is why they say that once you have a well
formulated problem, your problem is half solved - because it takes
half the time to just get there.
P.S. Wondering if you got the pun (actually taken from computer help
desk lore and not really aimed at this particular poster).

Subject: Scanning Binary Images

From: Prasenjeet Patil

Date: 25 Mar, 2009 05:03:03

Message: 9 of 11

Thanks again,
I am working on license plate recognition.I had divided the project in two modules.First to detect and extract the plate.Second to do segmentation and character recognition.
I am trying the, reply given by Dave for summing the pixels.I had read many ieee papers & decided to go for edge detection using sobel edge detection. I had converted the given image to gray(rgb2gray), binarized it(im2bw) and done sobel edge detection for vertical edges.Now I want to get the number of 1's(logical) in the binary image.So that I can crop the license plate region.Also suggest where to upload the images.

Subject: Scanning Binary Images

From: ImageAnalyst

Date: 25 Mar, 2009 10:16:01

Message: 10 of 11

"Prasenjeet Patil"

Try uploading to one of these (just 4 among hundreds of choices)
http://posterous.com/
http://imageshack.us/
http://www.flickr.com/
http://drop.io/

It will be interesting to see the pictures because I can't visualize
how taking the sobel filter of an image, thresholding it, and simply
counting the number of pixels will extract only those edges that
encase the license plate. Counting pixels gives you a single number,
not a region. What you need is all the pixels that are inside the
license plate and I'm pretty sure a single number (which would include
points elsewhere in the image not even in the license plates) can't do
it.

Subject: Scanning Binary Images

From: Yumnam Kirani Singh

Date: 25 Mar, 2009 11:38:31

Message: 11 of 11

for your problem, you first find the connected components, then find the lengths of the connected components in your image after soble edge detection. Based on the lengths of the connected componets, select those parts which are the components of your interests. Then use those components of interests for recognition.

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
sobel Sprinceana 20 Sep, 2009 09:29:37
edge detection Sprinceana 20 Sep, 2009 09:29:37
rssFeed for this Thread

Contact us at files@mathworks.com