-
Notifications
You must be signed in to change notification settings - Fork 437
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
ocioview: Cube Inspector #1875
ocioview: Cube Inspector #1875
Conversation
Signed-off-by: Michael Dolan <[email protected]>
Signed-off-by: Michael Dolan <[email protected]>
if self._input_src == InputSource.IMAGE and self._image_buf is not None: | ||
image_spec = self._image_buf.spec() | ||
identity_grid = self._image_buf.get_pixels( | ||
oiio.FLOAT, | ||
roi=oiio.ROI( | ||
# fmt: off | ||
image_spec.x, | ||
image_spec.x + image_spec.width, | ||
image_spec.y, | ||
image_spec.y + image_spec.height, | ||
0, 1, | ||
0, 3, | ||
# fmt: on | ||
), | ||
).reshape((image_spec.width * image_spec.height, 3))[:: self._image_detail] | ||
sample_count = identity_grid.size // 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked at all the code yet but as I'm working on the chromaticity diagram and I need a ndarray
, I'm wondering if rather than passing an OIIO ImageBuf
around, it would not be better to be in Numpy
land.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with that, in #1853 I'm making OIIO an optional dependency (same for Imath, basically everything that doesn't have PyPI package ideally).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I can change it to a ndarray
.
self._mouse_button = None | ||
self._mouse_last_pos = None | ||
self._cpu_proc = None | ||
self._image_buf: np.ndarray = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type is oiio.ImageBuf
here I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Thanks!
I'm going to close this for now, and will open a new PR once we settle on a graphics framework for this and other |
This PR adds a cube inspector to ocioview, which is a 3D viewport that plots a color cube or image as a point cloud, with the current viewer's processor applied.
Individual points can be clicked to sample them, displaying RGB output values and a swatch, similar to the image viewer. I had originally implemented sampling on hover, but depending on the image density, this can get slow, so I removed it for now.
Other options provide control of cube size, image sample density, sample decimal precision, whether to clamp samples to the source cube, and whether to display source cube edges. Left click pans around the cube and the scroll wheel zooms towards or away from its center.
ocioview with Cube Inspector
![image](https://private-user-images.githubusercontent.com/2299963/271806036-4f04ddce-3565-4525-b8d4-b20d842c6ee4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYwMTM4MTIsIm5iZiI6MTcyNjAxMzUxMiwicGF0aCI6Ii8yMjk5OTYzLzI3MTgwNjAzNi00ZjA0ZGRjZS0zNTY1LTQ1MjUtYjhkNC1iMjBkODQyYzZlZTQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MTFUMDAxMTUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjViY2I5YTc3MjFiYzc2M2Q5YzMzNTdmYTg4YTg2OTc4MGUyZDRjNGY4NDQ3MTA1NzY4ZWNiOTBiYjgwYjliMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.V0mbvufLXlhFsNC_-3qlH-aHh1TIWzHDbukMpXQTD8Y)
33x33x33 cube
![image](https://private-user-images.githubusercontent.com/2299963/271806469-01811e6b-c6a8-420a-af18-d9e7aff87058.png?jwt=eyJhbGciOiJIUzI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ZmJmYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.H_leDMeGhynZley_PMGldt8PEF-g2LLdeO5Pz89FWBw)
image point cloud, clamped
![image](https://private-user-images.githubusercontent.com/2299963/271806579-f4f94237-cd47-406d-bce6-ce40a8ec96ed.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYwMTM4MTIsIm5iZiI6MTcyNjAxMzUxMiwicGF0aCI6Ii8yMjk5OTYzLzI3MTgwNjU3OS1mNGY5NDIzNy1jZDQ3LTQwNmQtYmNlNi1jZTQwYThlYzk2ZWQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MTFUMDAxMTUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzZlMDJlZjQ1NDhiNzk1N2MyOGI0NGNkYjc0OTNjMjgxZDcxMGFmMDFjY2UyZDQ4YzU0ZDRmYzFlZGU5Zjg3NyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.YgLC87BuILQ1M9Y5fdlH0a2n8FORpZV3i1UmwdBJYNQ)
image point cloud, clamped, cube edges hidden
![image](https://private-user-images.githubusercontent.com/2299963/271806592-2d3d05e9-1d38-4f1d-bec2-0d3ef41fcf24.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWI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