From: Robert Pigeon on
Hello to all,

I have two questions related to image processing.

First question : I have some pictures taken with my digital camera and on
the pictures I have the date in red numbers on them. I would like to erase
those numbers from the pictures. I tried the procedure described on Wolfram
web site about image processing (Removing text from an image). But it is
not working and I don't know why. Maybe some of you are doing it and could
share with me the procedure ?

Second question : I take a portion of an image using ImageTake. I do some
processing on that portion. Now I would like to put back that portion in the
original image. How can I do that? It would be like the inverse of
ImageTake... Any idea?

Thanks for any suggestions,

Robert

From: Matthias Odisio on
Robert,

On 6/25/10 6:26 AM, Robert Pigeon wrote:
> Hello to all,
>
> I have two questions related to image processing.
>
> First question : I have some pictures taken with my digital camera and on
> the pictures I have the date in red numbers on them. I would like to erase
> those numbers from the pictures. I tried the procedure described on Wolfram
> web site about image processing (Removing text from an image). But it is
> not working and I don't know why. Maybe some of you are doing it and could
> share with me the procedure ?
>

What exactly did you try? If you could point to an example that would be
easier to help.

> Second question : I take a portion of an image using ImageTake. I do some
> processing on that portion. Now I would like to put back that portion in the
> original image. How can I do that? It would be like the inverse of
> ImageTake... Any idea?
>

Assuming the portion you take has its top left corner at {r1, c1}:

sub = ImageTake[img, {r1, r2}, {c1, c2}]

new = ImageCompose[img, sub, {Left, Top}, {r1, c1}]

Matthias Odisio
Wolfram Research

From: Matthias Odisio on
Oops... Corrigendum:

On 6/25/10 8:52 AM, Matthias Odisio wrote:
> Robert,
>
> On 6/25/10 6:26 AM, Robert Pigeon wrote:
>> Hello to all,
>>
>> I have two questions related to image processing.
>>
>> First question : I have some pictures taken with my digital camera and on
>> the pictures I have the date in red numbers on them. I would like to
>> erase
>> those numbers from the pictures. I tried the procedure described on
>> Wolfram
>> web site about image processing (Removing text from an image). But it is
>> not working and I don't know why. Maybe some of you are doing it and
>> could
>> share with me the procedure ?
>>
>
> What exactly did you try? If you could point to an example that would be
> easier to help.
>
>> Second question : I take a portion of an image using ImageTake. I do some
>> processing on that portion. Now I would like to put back that portion
>> in the
>> original image. How can I do that? It would be like the inverse of
>> ImageTake... Any idea?
>>
>
> Assuming the portion you take has its top left corner at {r1, c1}:
>
> sub = ImageTake[img, {r1, r2}, {c1, c2}]


We need some more gymnastics:

h = Last(a)ImageDimensions@img;

That was incorrect:
> new = ImageCompose[img, sub, {Left, Top}, {r1, c1}]

It should be:
new = ImageCompose[img, sub, {c1 - 1, h + 1 - r1}, {Left, Top}]

Matthias Odisio
Wolfram Research

From: Patrick Scheibe on
Hi,

the good thing in image processing is that a method never applies
to all situations. Bad people say it only applies in the specific
testcase for what it was written.
I would take Gimp or Photo-Shop|Paint or any other ip-software and
use the *repair*-brush (sorry, I don't know the english word), since
this is faster.

The method at

http://www.wolfram.com/products/mathematica/newin7/content/BuiltInImageProcessing/RemoveTextFromAnImage.html

works on the whole image and I wouldn't use it on my photos.
Maybe this is more appropriate and can be adapted to your photo. It
should answer your second question too:

img = ImageResize[
Import["http://lessflowermorepower.files.wordpress.com/2009/08/\
dsci0004.jpg"], 300]
{nx, ny} = ImageDimensions[img];
date = ImageTake[img, {190, 225}, {150, 300}]
{r, g, b} = ColorSeparate[date]
mask = Dilation[Binarize[ColorNegate[b]], 1]
street = ImageMultiply[date, ColorNegate[mask]]
tile1 = ImageMultiply[Closing[street, 4], mask]
tile2 = ImageMultiply[ColorNegate[mask], date]
tile3 = ImageAdd[tile1, tile2]
ImageCompose[img, tile3, {150, 0}, {0, 0}]

Cheers
Patrick

PS: If the randomly selected image link isn't working, let me know.

On Fri, 2010-06-25 at 07:26 -0400, Robert Pigeon wrote:
> Hello to all,
>
> I have two questions related to image processing.
>
> First question : I have some pictures taken with my digital camera and on
> the pictures I have the date in red numbers on them. I would like to erase
> those numbers from the pictures. I tried the procedure described on Wolfram
> web site about image processing (Removing text from an image). But it is
> not working and I don't know why. Maybe some of you are doing it and could
> share with me the procedure ?
>
> Second question : I take a portion of an image using ImageTake. I do some
> processing on that portion. Now I would like to put back that portion in the
> original image. How can I do that? It would be like the inverse of
> ImageTake... Any idea?
>
> Thanks for any suggestions,
>
> Robert
>


From: Robert Pigeon on
Hello Patrick,
You are right about using a "commercial" paint/pictures software for
doing that. I used PhotoShop Element 8 to do it and it does exactly what I
wanted. But, after looking at the method posted at Wolfram web site
(RemoveTextFromAnImage) I wanted to try it. And it did dot worked. So I
tried to find out why and build my own process, just because the problem was
there!
I thought of what you proposed: doing the process on the part of the
image where the date is. That was working. Then came my second question: how
to put back that portion of the image in the original.

Anyway, thanks for your reply.! I will study your process and learn from it.

Thanks again,

Robert

-----Message d'origine-----
De : Patrick Scheibe [mailto:pscheibe(a)trm.uni-leipzig.de]
Envoy=E9 : 25 juin 2010 10:06
=C0 : Robert Pigeon
Cc : mathgroup(a)smc.vnet.net
Objet : Re: Image processing Questions

Hi,

the good thing in image processing is that a method never applies
to all situations. Bad people say it only applies in the specific
testcase for what it was written.
I would take Gimp or Photo-Shop|Paint or any other ip-software and
use the *repair*-brush (sorry, I don't know the english word), since
this is faster.

The method at

http://www.wolfram.com/products/mathematica/newin7/content/BuiltInImageProce
ssing/RemoveTextFromAnImage.html

works on the whole image and I wouldn't use it on my photos.
Maybe this is more appropriate and can be adapted to your photo. It
should answer your second question too:

img == ImageResize[
Import["http://lessflowermorepower.files.wordpress.com/2009/08/\
dsci0004.jpg"], 300]
{nx, ny} == ImageDimensions[img];
date == ImageTake[img, {190, 225}, {150, 300}]
{r, g, b} == ColorSeparate[date]
mask == Dilation[Binarize[ColorNegate[b]], 1]
street == ImageMultiply[date, ColorNegate[mask]]
tile1 == ImageMultiply[Closing[street, 4], mask]
tile2 == ImageMultiply[ColorNegate[mask], date]
tile3 == ImageAdd[tile1, tile2]
ImageCompose[img, tile3, {150, 0}, {0, 0}]

Cheers
Patrick

PS: If the randomly selected image link isn't working, let me know.

On Fri, 2010-06-25 at 07:26 -0400, Robert Pigeon wrote:
> Hello to all,
>
> I have two questions related to image processing.
>
> First question : I have some pictures taken with my digital camera and on
> the pictures I have the date in red numbers on them. I would like to erase
> those numbers from the pictures. I tried the procedure described on
Wolfram
> web site about image processing (Removing text from an image). But it is
> not working and I don't know why. Maybe some of you are doing it and could
> share with me the procedure ?
>
> Second question : I take a portion of an image using ImageTake. I do some
> processing on that portion. Now I would like to put back that portion in
the
> original image. How can I do that? It would be like the inverse of
> ImageTake... Any idea?
>
> Thanks for any suggestions,
>
> Robert
>