Zerene Stacker and retouch color control

A forum to ask questions, post setups, and generally discuss anything having to do with photomacrography and photomicroscopy.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

elf
Posts: 1416
Joined: Sun Nov 18, 2007 12:10 pm

Zerene Stacker and retouch color control

Post by elf »

Is it possible to use the color and brightness from the input image when doing retouching?

These two screenshots should show the issue:
Retouch screenshot (The red arrow points to a small section that has been retouched):
Image

Original PMax output:
Image

The retouched spot is much lighter than the original.

rjlittlefield
Site Admin
Posts: 23543
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

Is it possible to use the color and brightness from the input image when doing retouching?

Short answer: no. [Update: Yes. "Paint the pixels" brushes have been provided since Build T201302191410 (Feb 19, 2013). This is a Pro-only feature accessed via the "More brushes checkbox" while retouching.]

Better answer: no, but you can probably get what you want by using a larger brush, probably in conjunction with Stack Selected.

Long explanation follows...

The retouching brush in ZS is in the business of copying detail, not pixel values. Roughly speaking, "detail" means differences compared to surrounding areas, and "surrounding areas" means a region that is about three times as big as the retouching brush. (Think of adding one brush diameter on each side.)

What you've illustrated is running a small brush over a large dark area in the source frame. In that case, the detail that the brush picks up consists of low contrast vertical stripes, represented as small deltas from the overall brightness and color of the surrounding area in the source image. The process is then reversed to deposit that same detail into the retouched image, so what gets laid down are low contrast vertical stripes merged with the overall brightness and color of the surrounding area in the retouched image. As you've shown, the result ends up being much lighter in the retouched image than it was in the source image.

This behavior is by design. Paint-the-details plays very nicely with the paradigm of merging PMax with DMap and original source. This is because PMax often alters regional brightness as a side effect of its preserving detail at all scales. Using an ordinary paint-the-pixels brush in a region of altered brightness tends to produce blotches, while paint-the-details generally produces seamless results as a matter of course.

There are two tricks to getting the result that I think you want. The first is to use Stack Selected to generate an output image that has the detail you want over a large area. For example if that dark blue region is the filament of a stamen, then you would Stack Selected those frames containing just the filament and possibly things in front of it. The result of this Stack Selected would be an output image containing a clean rendering across the whole width of the filament.

The second trick is to use a large brush -- the largest size that will just barely fit into the area you want to copy. In this case, an appropriate brush size would be just a little less than the entire width of the filament.

Combining these two tricks, what happens is that the "detail" picked up by the large brush will be the vertical stripes in the filament, plus the fact that the area covered by the brush is significantly darker than its surroundings. Both those aspects then get deposited into the retouched image, with the result that the filament ends up looking pretty much the same as it did in the Stack Selected intermediate output image.

Using Stack Selected does not play nicely with all stacks. In case it does not, you can still use the large-brush technique with original source by using a two-step process. First, use a large brush to transfer the overall tone over a large area. Then come back with a smaller brush and copy in-focus details from each frame.

These processes are pretty effective, but inevitably you get an output image that has small differences in brightness from the inputs.

If exact copying is needed, what you have to do at this time is go outside ZS by writing output images to standard files, then pull them into Photoshop et.al. to do the cloning or mask painting.

Paint-the-pixels brushes (and other types) are "on the list" for future development in ZS. As usual, no schedule.

--Rik

Edit: to add information about the "More brushes" option.
Last edited by rjlittlefield on Wed Sep 03, 2014 2:45 pm, edited 1 time in total.

elf
Posts: 1416
Joined: Sun Nov 18, 2007 12:10 pm

Post by elf »

Thanks for the detailed response. I'll try using the larger brush and multiple partial stacks method.

While waiting for 'Paint the Pixels' brush, could we get a method to output full resolution aligned images? This would simplify the post processing in Photoshop.

rjlittlefield
Site Admin
Posts: 23543
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

elf wrote:While waiting for 'Paint the Pixels' brush, could we get a method to output full resolution aligned images?
That feature is top on the list right now, so coming soon.

--Rik

stevekale
Posts: 172
Joined: Wed May 11, 2011 2:40 pm
Location: London, UK

Post by stevekale »

Is resolution constrained?

rjlittlefield
Site Admin
Posts: 23543
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

stevekale wrote:Is resolution constrained?
I'm not sure what's being asked, but I assume it's related to what size detail gets copied.

The detail that gets copied is basically "whatever fits inside the brush". More precisely, it's whatever fits inside the region that is painted by the brush in a single stroke (mouse down, drag around, mouse up).

In the extreme of large brushes, you can make the brush bigger than the whole image, click once, and replace the whole retouched image with a copy of source. This is actually a useful technique, in the odd case that what you really want is to use an input image as the starting point for retouching.

At the small end, you can make the brush be just a few pixels wide, and copy hardly anything of value.

Most of the useful sizes lie somewhere in the middle.

The guiding principle for most uses is to make the brush be about the same size as the region you want to work with, or a little smaller so that you can paint irregular boundaries but still cover the whole region in a relatively short time in a single press/drag/release sequence.

Sometimes people ask how "hard" the brush is, and whether there's a way to control the hardness. The answer to the second part is simple: at this time there's no way to control the hardness. The answer to the first part is not so simple, because the "hardness" of the brush really depends on the size of detail that's being painted. The brush has a very hard edge for detail at the level of individual pixels, but it becomes progressively softer for detail at coarser levels, roughly speaking in proportion to the size of the detail in question. Sometimes I speak of this as a "multiresolution blending brush", but you may want to think of it as "adaptive hardness".

I think this concept is alien to users of Photoshop et.al., so let me illustrate by example. What I'm going to illustrate is retouching from a region containing several levels of detail into a region containing no detail at all. (The target image is actually the last frame of a stack, severely OOF but nonetheless registered against the highly detailed image which is a stacked output.)

Here is what we get using the retouching brush in Zerene Stacker (one click, no drag, followed by moving the brush away so you can see the result):

Image

Here are equivalent attempts in Photoshop:
Image

Looking at the upper right of the brush circle, you can see that Zerene Stacker's brush has painted full-contrast detail clear out to the edge, very much like Photoshop's hardness 100%. But at the upper left where there is no real detail, the overall tone of the brushed region has been smoothly graded between source and target, very much like Photoshop's 0%. Where there is intermediate level detail, say at lower right, then Zerene's brush has acted like some intermediate hardness in Photoshop's terms, something like 50% or a bit higher in this case.

Again, this behavior of Zerene's brush is fully automatic, no controls required or provided.

I hope this explanation is helpful. In the past I've shied away from trying to explain in detail what the brush does because a) most of the time there's no need to think about it at all, and b) when you do need to think about it, it's hard to find a good model to reason by analogy. Perhaps these visual examples will work. Please ask again if still unclear.

--Rik

ChrisR
Site Admin
Posts: 8662
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

I have found that when the brush is very small - a few pixels - it sometimes doesn't seem to copy anything. So you yave to make the brush bigger than you wanted, and then change to an unretouched source to put back the unwanted changes around the part you did want to change.

It's as though the brush gets too "transparent" when it's very small, in Photoshop terms.

stevekale
Posts: 172
Joined: Wed May 11, 2011 2:40 pm
Location: London, UK

Post by stevekale »

My question was prompted by the words
elf wrote:could we get a method to output full resolution aligned images?
which led me to think that output resolution was constrained in some way.

rjlittlefield
Site Admin
Posts: 23543
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

I have found that when the brush is very small - a few pixels - it sometimes doesn't seem to copy anything.
Hhmm... I admire your diligence in checking the end cases, but if would be nice if you'd let me know about these problems when you notice them, instead of letting them fester.

Brush radius is implemented as an integer. In testing just now, I can paint with a brush as small as 3 pixels wide -- center coordinate plus and minus radius=1. I can not paint with a brush as small as 1 pixels wide -- center coordinate +-0. That's due to a particular IF-statement, < versus <=, which will be fixed in the next release.

The other issue is that when you're stroking with such a small brush, you have to stroke slowly so that the application gets to see the brush at each location. At present, retouching is implemented as a stamp/stamp/stamp operation, so if you move quickly with a tiny brush, you can get relatively big gaps in the result.

If you're aware of other issues, please let me know. I confess, I mostly exercise retouching with fairly large brushes to select regions, as opposed to trying to paint details pixel by pixel. There may well be other problems with tiny brushes that I don't know about.

--Rik

rjlittlefield
Site Admin
Posts: 23543
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

stevekale wrote:My question was prompted by the words
elf wrote:could we get a method to output full resolution aligned images?
which led me to think that output resolution was constrained in some way.
Ah, I see. I did not notice the exact phrasing of elf's question, which may be a bit misleading. In normal operation, Zerene Stacker creates a set of "preview images", one per source image. Those are full resolution but low quality in the sense of high compression JPEG. There's a frequent request to export arbitrarily high quality versions of those same images. I implicitly assumed that's what elf was talking about, and that export feature is what I'm working on.

The behavior of the retouching brush is a completely different issue, but at the moment I'm happy to have misunderstood your question since I think the explanation came out pretty well. Time and further replies will tell!

--Rik

ChrisR
Site Admin
Posts: 8662
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

let me know about these problems when you notice them,

:D I did Rik, it's not a new thing. I think the devil is in the "seems to", ie on some images something happens which isn't apparent on another. You went to some lenghts to explain how the brush wasn't like a Photoshop brush. I used the word "hardness" at the time.
Part of your reply, May 2009 ( was it really!!! ) which I think helps as part of your explanation above:

"what ZS has right now is not an ordinary
paint-the-pixels brush, it's actually a paint-cells-of-the-pyramid
brush. What happens is that both images get decomposed into pyramids
of details, those details being expressed as a difference between each
cell and an average of surrounding cells. The brush then copies
details (differences) from one pyramid to the other. At the finest
level of detail -- actual pixels -- all cells within the brush get
copied. At the next level of detail, 2X coarser, the edges of the
brush erode a little and some cells around the edge don't get copied.
Likewise at the next level of detail, and so on. At some point, the
brush gets eroded so much that it doesn't have any further effect."

So what I explained was just the workaround I've used to deal with it.

I don't remember noticing an oddity with a single pixel, though that may well have been part of what I was doing. If retouching a triangle shape, coloring in with a single pixel can make sense, not the same as "retouching single pixels".

I think you can be forgiven for not remembering every wrinkle and oddity that someone thinks they've seen :wink:

rjlittlefield
Site Admin
Posts: 23543
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

ChrisR wrote:If retouching a triangle shape, coloring in with a single pixel can make sense, not the same as "retouching single pixels".
Good point. The radius=0 bug does prevent filling in a small region with a single-pixel brush, which was intended to work (but doesn't because of the bug).
ChrisR wrote:
let me know about these problems when you notice them,

:D I did Rik, it's not a new thing. I think the devil is in the "seems to", ie on some images something happens which isn't apparent on another. You went to some lenghts to explain how the brush wasn't like a Photoshop brush. I used the word "hardness" at the time.
...

I think you can be forgiven for not remembering every wrinkle and oddity that someone thinks they've seen :wink:
I actually did remember and review that conversation. The problem was that I didn't recognize it as being related to your comments here about a "very small" brush.

To recap, here's the situation you showed me back in May 2009:

Image

Your description then was:
Working from the cleaner image on the left, the retouch brush is needing several passes to transfer the Black area, about where the cursor is.
It's behaving like a low hardness brush in Photoshop. The effect is actually larger than the brush circle.
With a very small brush, it's doing almost nothing on each pass.
There may be good logic behind this, but for these images it isn't useful.
Perhaps it's only/mostly at high magnification?
You've already quoted part of my reply. Another part that may help readers here is this:
One style of use that helps a lot is to first use a brush that's about the same size as the big features you want to copy, then shrink the brush if necessary to refine some of the details. For example if you're trying to copy a black bristle, then start with the brush about as big as the bristle diameter. If you make the brush much smaller than the bristle, then when it's in the center of the bristle it's not going to do much if anything because there are no differences to be painted there.

The screenshot that you sent represents just about the worst case. Comparing that little black area inside the brush against the big black area around it, there's no detail the size of the brush to be copied, so what gets copied over are zeroes. But on the right side, the area inside the brush is so fuzzy that those pyramid cells were almost zero anyway. Hence the brush doesn't have much effect. To get a decent effect, you would need to make the brush maybe 3 or 4 times bigger.
None of this depends on the absolute size of the brush. It would do the same thing if this were a radius 200 brush working inside a very large fuzzy image.

I hope this helps. Thanks for the further discussion.

--Rik

ChrisR
Site Admin
Posts: 8662
Joined: Sat Mar 14, 2009 3:58 am
Location: Near London, UK

Post by ChrisR »

Ah, Ok, so there's two things happening with v small brushes, one an effect, and one a bug which I hadn't discovered though was possibly confused by! Anyway, I wanted to be clear that nothing had been "festering" :)
Either way, the workaround works fine.

rjlittlefield
Site Admin
Posts: 23543
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

All is good...thanks for the discussion.

--Rik

ChrisLilley
Posts: 674
Joined: Sat May 01, 2010 6:12 am
Location: Nice, France (I'm British)

Post by ChrisLilley »

Rik, thanks for the clear description of how the retouch brush works. Very helpful, particularly the advice to go for the largest brush that will fit, as opposed to scrubbing around with a small one.

Post Reply Previous topicNext topic