Nona changes slightly the pixel rgb

Asked by Nivaggioli on 2018-04-13

Hello everyone,

I am using nona to convert a panoramic image to 6 images from a cubemap.

But nona changes sligthly the value of some pixel, for example, if I have an object in my panoramic image that is at (4,1,200), nona might change it as (4,2,200) in the cubemap (even in the middle of the object, it is not a problem of aliasing or interpolation).

I know this sounds like nothing,nut I really need to keep my pixels value EXACTLY as they are, at least inside my object.

Here is a sample from my code if you want to see my configuration :

FOR /R %%i IN (Niveau_5\*.png) DO (

echo %%i
set var=%%~ni
echo !var!

@echo Generating Face_0 FRONT
@echo p f0 w1024 h1024 v100 >script.txt
@echo m g1 i6 f0 m0>>script.txt
@echo o w4096 h2048 f4 p0 r0 v360 y0 u10 m0 n"%%i">>script.txt
@nona -m PNG -o Cube\!var!_0 script.txt

Thank you for your help!

Question information

Language:
English Edit question
Status:
Answered
For:
Hugin Edit question
Assignee:
No assignee Edit question
Last query:
2018-04-24
Last reply:
2018-04-24
tmodes (tmodes) said : #1

I still think that is an interpolation issue.
Your cube face has a field of view of 100 deg. For a cubemap it should be 90 deg.

Also there are other issues with the generated script:
* The input images should be in an i line (even if nona supports also o line.)
* In the i line the u and m switches are unknown.

Nivaggioli (stygian2a) said : #2

Thank you for the corrections! That fixed some others problems I had. But this particular issue is still there... Here is my new updated code :

FOR /R %%i IN (Niveau_5\*.png) DO (

echo %%i
set var=%%~ni
echo !var!
@echo Generating Face_0 FRONT
@echo p f0 w1024 h1024 v90 >script.txt
@echo m g1 i6 f0 m0>>script.txt
@echo i w4096 h2048 f4 p0 r0 v360 y0 n"%%i">>script.txt
@nona -m PNG -o Cube\!var!_0 script.txt

tmodes (tmodes) said : #3

I can't reproduce the issue. The remapped cube face have the same color as the original image.
So I still think this is an interpolation issue. A cube face can't be extracted 1:1 from an equirectangular image. There needs to be some interpolation and this is probably the result.

Or you need to provide the pto file and the image file and describe where to you see the "wrong" color.

PS: Writing a pto file with echo is not recommend. See all the issues your pto file have. Hugin comes with some command line tool to do all the steps from the terminal.

Nivaggioli (stygian2a) said : #4

Alright, so:

This is my original image:
https://ibb.co/ezZ48c

Let's focus on the part near the ladder on the right. The resultI get is :
https://ibb.co/dGet1x

In this particular image, the issue is on the black 'line' that goes across the bottom of the image and through the ladder.
In the original, the RGB value is (3,0,50)
In the cubemap, the RGB value becomes (4,0,50)

I have no idea why.My gamma is set to 1, and I chose i6 for interolation, which is supposed to be nearest-neighbors.

Here is my full code :

setlocal enabledelayedexpansion
FOR /R %%i IN (Niveau_5\*.png) DO (

echo %%i
set var=%%~ni
echo !var!
@echo Generating Face_0 FRONT
@echo p f0 w1024 h1024 v90 >script.txt
@echo m g1 i6 f0 m0>>script.txt
@echo i w4096 h2048 f4 p0 r0 v360 y0 n"%%i">>script.txt
@nona -m PNG -o Cube\!var!_0 script.txt
echo.

@echo.
@echo -----------------------------------------------------
@echo Generating Face_1 RIGHT
@echo p f0 w1024 h1024 v90 >script.txt
@echo m g1 i6 f0 m0>>script.txt
@echo i w4096 h2048 f4 p0 r0 v360 y270 n"%%i">>script.txt
@nona -m PNG -o Cube\!var!_1 script.txt
@echo.

@echo -----------------------------------------------------
@echo Generating Face_2 BACK
@echo p f0 w1024 h1024 v90 >script.txt
@echo m g1 i6 f0 m0>>script.txt
@echo i w4096 h2048 f4 p0 r0 v360 y180 n"%%i">>script.txt
@nona -m PNG -o Cube\!var!_2 script.txt
@echo.

@echo -----------------------------------------------------
@echo Generating Face_3 LEFT
@echo p f0 w1024 h1024 v90 >script.txt
@echo m g1 i6 f0 m0>>script.txt
@echo i w4096 h2048 f4 p0 r0 v360 y90 n"%%i">>script.txt
@nona -m PNG -o Cube\!var!_3 script.txt
@echo.

@echo -----------------------------------------------------
@echo Generating Face_4 UP
@echo p f0 w1024 h1024 v90 >script.txt
@echo m g1 i6 f0 m0>>script.txt
@echo i w4096 h2048 f4 p270 r0 v360 y0 n"%%i">>script.txt
@nona -m PNG -o Cube\!var!_4 script.txt
@echo.

@echo -----------------------------------------------------
@echo Generating Face_5 DOWN
@echo p f0 w1024 h1024 v90 >script.txt
@echo m g1 i6 f0 m0>>script.txt
@echo i w4096 h2048 f4 p90 r0 v360 y0 n"%%i">>script.txt
@nona -m PNG -o Cube\!var!_5 script.txt
@echo.
@del script.txt
)

pause

I am not using a pto file,only a .bat file (So i do all the steps from a terminal)

Thank you.

Nivaggioli (stygian2a) said : #5

Actually, there are two parts on the 'line'. One is (3, 0 , 50) and the other is (3, 0 ,37). But in the cubemap, the R value becomes 4 without any reason.

tmodes (tmodes) said : #6

>Let's focus on the part near the ladder on the right. The result I get is :
This is not the result of the script posted. The output of the script should be 1024x1024, this image is 640x640.

But I see now what you mean. This is the result of dithering which nona does to prevent banding (so there is a reason for this). This can't be switch off. And it not visible in real photos.

>I am not using a pto file,only a .bat file
Sorry, but this if wrong. You create a pto file from the bat file named script.txt - this is technical a pto file (even if you name it .txt).
And I don't want to debug your bat file, providing the necessary pto file would be more comfortable.

Can you help with this problem?

Provide an answer of your own, or ask Nivaggioli for more information if necessary.

To post a message you must log in.