Go Back   RetouchPRO > Technique > Photo Retouching
Register Blogs FAQ Site Nav Search Today's Posts Mark Forums Read

Photo Retouching "Improving" photos, post-production, correction, etc.

Repeated pattern from cloning

Thread Tools
Old 01-14-2016, 02:06 AM
klev klev is offline
Senior Member
Join Date: Jun 2010
Posts: 1,109
Re: Repeated pattern from cloning

Originally Posted by Eigil Skovgaard View Post
Hi Klev,

Yes, it would be possible to work around endless calculations through a shortcut here and there. Reality is often a sum of compromises.

One of the limiting parameters could be to establish the critical ratio between observation distance and pattern size. This could include knowledge of human perception. Eye-scanning details on the screen at 300 to 400 percent is dangerous, as we know, because the repeating pattern just outside the screen is not repeated in the visible image segment. First time I observed some kind of repetition in my replacement of foliage in the image in question was in the 2400 px x y image at 1:1 - when it was already shared, and I made an final check, just to be sure (wrong point in time).
That would be why I advise people not to zoom in too close. It can actually lead to detail loss in a lot of cases as well as just messing up broader details. I see this a lot when people flatten out facial structures by overlooking them.

Originally Posted by Eigil Skovgaard View Post
Btw - closer examined! the impression of annoying repetition is not on the leaf to leaf - or clusters of leaf - level, but in the repeating shadow-areas between the same two branches of leaf. This repetition would never be detected with a fixed size of a "sniffer". The search pattern would have to widen through a series of enlargements relative to the start-out size. Luckely computers work fast ...
Etc, etc.
I will end these considerations for now.
Repeating shadow areas would be caught by the method I suggested, assuming a suitable metric. I suggested finding individual matches, then examining whether a match holds when you consider the same neighbors for each pixel. Let's say pixel (x,x) matches pixel (y,y). You would want to have some clustering of similar values to narrow your search space, but you would then check whether pixel (x±1,x±1) matches pixel (y±1,y±1). If you keep getting matches when growing the set of pixels in the same direction, you will catch these patterns.

That is actually a lot of work to implement though. I think the focus on inpainting is more practical in a lot of ways. It has come a long way, as algorithms aimed at inpainting attempt to guess what would be there rather than directly copy data. They account for changes leading up to that pixel, which a retoucher has to do by hand when using a clone tool.

Originally Posted by Eigil Skovgaard View Post
Not obsessed ... I would use the expression passionate. I worked with a guy next office which was what I would call obsessed by mathematical thinking - in the sense that he could not let go and deal with other problems. Bread and butter problems for example. We worked on the same accounting system for an insurance company, and his low throughput of design and code finally got him fired. In the meantime he had developed and coded (during his working hours) a numbering system that he used as a kind of database. Even before this happened, he had told me, that he was generally out of work for the very same reason, he could not let the math go for more than a few sleeping hours.
Passion is (in my opinion) obsession in a controlled form - and necessary to widen the general level of knowledge without sending the passionate or visionary person to the finger-paint academy in the middle of the process ;O)
I can definitely relate to that guy, although I'm quite conscious of productivity when I work on something.
Reply With Quote top
Old 01-14-2016, 10:10 AM
Eigil Skovgaard Eigil Skovgaard is offline
Junior Member
Join Date: Jun 2010
Location: At the moment Scania, southern Sweden.
Posts: 24
Re: Repeated pattern from cloning

Hi Klev,

This is a practical example inspired from your last post and relating to my final image (3).
The suspect areas in this 2400 x 1595 px image regarding repeating patterns is one to the right, a rectangle of 200 x 258 px (x:2163, y:919; x:2363, y:1177) ... and another rectangle to the left, 334 x 325 px (x:327, y:728; x:661, y:1053). These areas represent 1,3 respectively 6 percent of the entire image area of 3,828,000 pixels.

In this case the user is instructed to select a pattern of which he will exclude repetitions within the two selected areas (1 instance is allowed for the total of both selections). The chosen source is a rectangle 12 x 13 px (x:2230, y:993; x:2242, y:1006). (This may be the practical limit for the ratio between image and search matrix. This matrix is about 4 ‰ of the entire image area.

Now please visualise the contained cross of pixels with its intersection through the centre of the matrix. The centre column and row of the cross represent 25 pixels very typical for the combination of the HSL values in the source pattern.

The search begins in the upper leftmost corner of the left selection in a 13 x 13 px area. The first examination regards the 13 horizontal centre pixels. If, let's say 80 percent of the pixels in the target row match the source row, the vertical part of the cross is compared. If the combination of the two directions represent an 80-100 percent match, the cross-position and angle is saved to a memory-stack. Otherwise the cross is rotated 1° cw around the centre, and a new examination of the "horizontal" and possible "vertical" centre pixels is executed. And so on until the cross has turned 360° and a smaller number of matching crosses have been stacked.

Now the wizard returns to the stack and check if any matching cross still matches on the nearest row and column through +1 and -1; +2 and -2 ... +6 and -6, proceding while a 80% match is maintained. Otherwise the entry is removed from the stack. A ≥ 80% match is saved for later marking.

From this initial position the search area is offset 50 percent (6 pixels) to the right and the prior sequence is repeated. When the entire row is done, the search position is offset 50 percent downwards - and so on, until the total selection (left ^ right) has been examined.
The found matches are marked and presented to the user, and he can execute the integrated content aware tool until he is satisfied. The content aware tool must be checked for not repeating itself.

The derived amount of calculations is realistic as far as I can see.

The described method would find at least one near match in my image. I made a layer only containing the search matrix and changed the blending mode to difference. Then moved the matrix around like the wizard would do (yet without rotation), until I found an almost "black" position here (x:2236, y:1117; x:2248, y:1130).
This is the second incident I can observe at the distance, and not when zoomed in.
Are there other incidents of this pattern that I have not spotted yet? Well, I got tired in my mouse-arm during the manual search ... a cumbersome work that a wizard would execute in practically no time.

The advantage of this wizard? ... Could be nice to have. But during this discussion I have realized that a bank of randomly generated settings of foliage (read: brushed to life) could work fine in this image, selectively let through a mask where needed.
Reply With Quote top

  RetouchPRO > Technique > Photo Retouching

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch removal of pattern from scanned images Madison Poster Image Help 9 12-29-2014 10:48 PM
Removing Embossed Paper Pattern AdvencedGuest Photo Restoration 11 07-24-2013 03:04 PM
texture pattern michael79f Image Help 3 10-09-2012 02:00 AM
replicating a difficult pattern & removing shadow ali_bahman Photo Retouching 1 02-10-2012 11:33 AM
Stray hairs over pattern timmy1729 Image Help 7 08-06-2009 06:54 PM

All times are GMT -6. The time now is 03:18 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2016 Doug Nelson. All Rights Reserved