Page 5 of 5

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-29T20:24:48-07:00
by fmw42
You can also try my redist script. It tries to make each image have the same mean and standard deviation (sigma). So you decide what mean and what sigma you want and apply the same values to each tile. Play with the arguments for one tile until you like the results and then use the same values for each of the other 3 tiles.

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-29T20:56:54-07:00
by ProGamer
fmw42 wrote: 2017-01-29T20:15:13-07:00 Imagemagick has similar tools for clipping the image/histogram. See -level or -contrast-stretch or my script levels.

If you modify each image separately, you might get a result that is not what you want. Perhaps you should modify one tile the way you want it to look visually using PS or IM -level etc. Then use transfercolor to modify each of the other 3 tiles. Then combine them into your final image.

Did you try my modified commands above putting -background transparent before -append?

Yes, I tried:

Code: Select all

convert 1200px-Canaletto_-_Bucentaur.jpg 1200px-Sandro_Botticelli.jpg russian.jpg -background transparent -append line.miff
./transfercolor2.sh -c rgb neuraldream_3.png line.miff neuraldream_3_style.png
./transfercolor2.sh -c rgb neuraldream_2.png line.miff neuraldream_2_style.png
./transfercolor2.sh -c rgb neuraldream_1.png line.miff neuraldream_1_style.png
./transfercolor2.sh -c rgb neuraldream_0.png line.miff neuraldream_0_style.png

And it created this: https://i.imgur.com/tgQ3WyW.jpg
For comparison, the unmodified output: https://i.imgur.com/r5gmvHs.jpg

So it appears like your modifications to the script, work.

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-29T21:00:00-07:00
by ProGamer
fmw42 wrote: 2017-01-29T20:24:48-07:00 You can also try my redist script. It tries to make each image have the same mean and standard deviation (sigma). So you decide what mean and what sigma you want and apply the same values to each tile. Play with the arguments for one tile until you like the results and then use the same values for each of the other 3 tiles.
Ideally I would probably use the first tile, "tile 0" as the reference point, while I transfer the detected values to the other tiles. Then once the the tiles are all uniform, then the user can manually edit the combined tiled output to their liking.

Though I need to figure out how to extract the needed values from the first tile using ImageMagick and bash, and then I can probably pretty easily plug those collected values into the applicable ImageMagick commands.

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-30T10:23:37-07:00
by ProGamer
So I can use these commands to extract the needed info like this, I assume:

Code: Select all

convert image.png -format "%{colorspace]" info:
convert image.png -format "%[channels]" info:
convert image.png -format "%[standard-deviation]" info:
convert image.png -format "%[mean]" info:
convert image.png -format "%[min]" info:
convert image.png -format "%[max]" info:
Then I need to use something like:

https://www.imagemagick.org/script/comm ... hp#channel

Or: https://www.imagemagick.org/script/comm ... #statistic

Code: Select all

-statistic type geometry
Or maybe the -set command: https://www.imagemagick.org/script/comm ... ns.php#set

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-30T10:35:34-07:00
by fmw42
I do not understand your reference to those links.

Using -channel X you can get those statistics for any given channel. The function -statistic will generate a local statistic (within a moving window) for each pixel in an image. I am not sure how either of these help your goal.

What do you want to do with the statistics you have generated?

Note that you can put each into a variable for later use by

mean=`convert image.png -format "%[mean]" info:`
echo "$mean"

You can put them all into variable in one command. But before digressing to that, it might be better to understand what you want to do with those variables.

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-30T20:10:46-07:00
by ProGamer
Testing your redist script, and your color level scripts, along with many combinations of ImageMagick commands, I can't seem to replicate the results from GIMP.

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-30T20:16:43-07:00
by fmw42
What are you doing in GIMP that you need IM to reproduce? Give details of the GIMP commands you use and perhaps screensnaps of the control panels.

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-31T12:07:16-07:00
by ProGamer
fmw42 wrote: 2017-01-30T20:16:43-07:00 What are you doing in GIMP that you need IM to reproduce? Give details of the GIMP commands you use and perhaps screensnaps of the control panels.
Here's a GIF of the exact process I followed in GIMP for 3 of the tiles (I selected "levels" under the "colors" option. After I type "50", I hit the enter key afterwards instead of clicking.): https://i.imgur.com/87XtkWD.gifv

It appears like both the in addition to the black triangle, the grey triangle also moves when I hit enter. I think the grey triangle might be for the middle value, but the actual numbers of the middle value don't seem to update to reflect these changes? Or maybe some other kind of change is occurring that keeps the same value, but moves the grey triangle's position?

Which created this tiled output: https://i.imgur.com/JtEGR24.jpg

Though my chosen values are not perfect as this is the un-blended output: https://i.imgur.com/apFiHYr.jpg

The problem is that this GIMP procedure seems to be added onto the image instead of setting new values, as when I try the same steps on the 4th tile, it becomes out of sync with the other 3 tiles. The two options I think are, either searching for tiles that need to be modified, and modifying them while leaving the other tiles unmodified, or finding a way to set the exact same values (still don't know which values and how) to all of the tiles.




If you need to replicate my tiling script for tests (Imgur might degrade the tile quality?):

This is a version of my script that does not require Neural-Style: https://gist.github.com/ProGamerGov/3df ... 464ed96921

The file structure needed by the script is:

Code: Select all

output/neuraldream/tiles/
Rename this image: https://i.imgur.com/5Yb9X8g.png to neuraldream.png and place it in this folder:

Code: Select all

output/


You also need to place a copy of the neuraldream.png image just outside the "output folder, where the neural-tile-2x2.sh script is also placed.

For the unprocessed tiles (There names are in the image descriptions): https://imgur.com/a/FUg5s

Place the unprocessed tiles here:

Code: Select all

output/neuraldream/


For the processed tiles (There names are in the image descriptions): https://imgur.com/a/wmoAL

Place the processed tiles here:

Code: Select all

output/neuraldream/tiles/
Then run the script with:

Code: Select all

sudo bash ./neural-tile-2x2.sh neuraldream.png neuraldream.png

The newly created images will be placed into this folder:

Code: Select all

output/
Edit: I also should add that I have been experiencing an internet outage due to an unknown cause and may not be able to reply/comment here as quickly. Hopefully the issue will be resolved today, or within a few days.

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-31T12:25:28-07:00
by snibgo
ProGamer wrote:I selected "levels" under the "colors" option. When I type "50", I hit the enter key afterwards instead of clicking
In IM, this is:

Code: Select all

convert toes.png -level 19.608%,100% t2.png
This is because 50/255 = 0.19608.

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-31T12:32:00-07:00
by fmw42
I was just about to say the same thing as snibgo.
The problem is that this GIMP procedure seems to be added onto the image instead of setting new values, as when I try the same steps on the 4th tile, it becomes out of sync with the other 3 tiles.
I do not understand this. What do you mean by "add onto the image instead of setting new values"?

If this procedure does not work, then why did you refer to it? I got the impression that you had a method from GIMP that works and you needed to do the same in Imagemagick.

Anyway, try what snibgo said and see if you get the same results as GIMP or if the 4th tile works better.

P.S. Using the same level values for each image, may result in different results, since the statistics of each image are different.

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-31T16:55:24-07:00
by fmw42
Perhaps I misunderstand the issue. Is the problem that the tiles are not balanced correctly or have a good brightness/contrast? Or is the issue that your overlap blending is not working adequately.

If the former, can you provide a simple command line (not script) that composites the 4 tiles together with blending, so that I can take your unprocessed image combine them. Then try processing the raw tiles and combine those. I want to compare different processing schemes for getting similar looking tiles.

If the latter please clarify. When I look at your latest results, you have compared not blending to blended, which is confusing me.

Re: Correcting tile luminance and/or color differences?

Posted: 2017-01-31T19:42:15-07:00
by ProGamer
fmw42 wrote: 2017-01-31T16:55:24-07:00 Perhaps I misunderstand the issue. Is the problem that the tiles are not balanced correctly or have a good brightness/contrast? Or is the issue that your overlap blending is not working adequately.
The problem is the brightness between the tiles, not the blending technique. The blending technique seems to disguise minor differences between tiles. Sorry for the confusion.
fmw42 wrote: 2017-01-31T16:55:24-07:00 If the former, can you provide a simple command line (not script) that composites the 4 tiles together with blending, so that I can take your unprocessed image combine them. Then try processing the raw tiles and combine those. I want to compare different processing schemes for getting similar looking tiles
I'll send you a PM that links to a Google Drive folder containing 5 different tiling sets that I have made, with the original image, content image, style image(s), and both processed and unprocessed tiles. The text file in the folder contains the overlap values for the height and width, for each set of processed tiles. All 5 have the same issue of the tiles not being close enough to each other in terms of either brightness or color.

For example, these commands will work for the neuraldream output:

Code: Select all

# Smush the non-feathered tiles together

	convert \( neuraldream_0.png neuraldream_2.png +smush -97.462 \) \
			\(  neuraldream_3.png  neuraldream_3.png +smush -97.462 \) \
			-background none -smush -97.4435  large.png
			
#This will make the feathered tiles for the feathered image that's needed for the blending process. 		
convert neuraldream_0.png -alpha set -virtual-pixel transparent -channel A -morphology Distance Euclidean:1,50\! +channel neuraldream_0_f.png
convert neuraldream_1.png -alpha set -virtual-pixel transparent -channel A -morphology Distance Euclidean:1,50\! +channel neuraldream_1_f.png
convert neuraldream_2.png -alpha set -virtual-pixel transparent -channel A -morphology Distance Euclidean:1,50\! +channel neuraldream_2_f.png
convert neuraldream_3_.png -alpha set -virtual-pixel transparent -channel A -morphology Distance Euclidean:1,50\! +channel neuraldream_3_f.png

	convert -background transparent \( neuraldream_0_f.png neuraldream_1_f.png +smush -97.462 -background transparent \) \
			\( neuraldream_2_f.png neuraldream_3_f.png +smush -97.462 -background transparent \) \
			-background none  -background transparent -smush -97.4435  feathered.png

			
	# 8. Combine feathered and un-feathered output images to disguise feathering. (The blended output)
	composite feathered.png large.png final.png


This was what I used to chop the original image up into tiles:

Code: Select all

convert neuraldream.png -crop 2x2+50+50@ +repage +adjoin neuraldream_tile.png
Hopefully this is the information you needed?