Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFA tag is relative to the Crop XY #30

Open
LebedevRI opened this issue Jan 11, 2017 · 4 comments
Open

CFA tag is relative to the Crop XY #30

LebedevRI opened this issue Jan 11, 2017 · 4 comments

Comments

@LebedevRI
Copy link
Member

CFA2 is not, thankfully.

So e.g. if we have:

	<Camera make="Panasonic" model = "DMC-FZ28">
		<ID make="Panasonic" model="DMC-FZ28">Panasonic DMC-FZ28</ID>
		<CFA width="2" height="2">
			<Color x="0" y="0">BLUE</Color>
			<Color x="1" y="0">GREEN</Color>
			<Color x="0" y="1">GREEN</Color>
			<Color x="1" y="1">RED</Color>
		</CFA>
		<Crop x="0" y="0" width="-56" height="-4"/>
		<Sensor black="15" white="3986"/>
	</Camera>

If we change crop x/y by a multiple of two, everything is fine.
But if we change it by just one, we also need to adjust <CFA>

@axxel
Copy link
Contributor

axxel commented Jan 11, 2017

The code says otherwise: https://github.com/darktable-org/rawspeed/blob/develop/RawSpeed/RawDecoder.cpp#L579-L583

I was just about to suggest to implement just that when I remembered having seen it before. If there is some bug it should be fixed but the meaning of the origin of the CFA pattern should stay as is (relative to the uncropped sensor).

@LebedevRI
Copy link
Member Author

The code says otherwise: https://github.com/darktable-org/rawspeed/blob/develop/RawSpeed/RawDecoder.cpp#L579-L583

Do note that it is in if (applyCrop) {

@axxel
Copy link
Contributor

axxel commented Jan 11, 2017

Yes? Please have a closer look at what the code does: if applyCrop is false, then the 'cropped' image is simply the 'complete'/'uncropped' image. And since the CFA data is originally parsed with respect to this uncropped image, it stays as is.

@LebedevRI
Copy link
Member Author

LebedevRI commented Jan 11, 2017

Very interesting, i remember the opposite thing.
But even https://github.com/darktable-org/rawspeed/blob/develop/data/README.md agrees with you

This is the position at of the colors on the uncropped image, so it will be the same
no matter what crop you specify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants