Hi all.
I'm wondering if there is a way to get brightest and darkest RGB values in COP context.
I searched and found this thread without any clear answer: http://forums.odforce.net/topic/3417-brightest-point-in-image/ [forums.odforce.net]
Any ideas?
Thanks.
Getting Brightest and Darkest Pixels in COP
3702 11 2- Nima
- Member
- 471 posts
- Joined: Nov. 2013
- Offline
- Konstantin Magnus
- Member
- 670 posts
- Joined: Sept. 2013
- Offline
Hi Nima,
in SOPs attribute promote has methods for getting the highest and lowest value of an attribute. I promoted the results to detail and imported them to COPs inside a VOP COP2 filter.
in SOPs attribute promote has methods for getting the highest and lowest value of an attribute. I promoted the results to detail and imported them to COPs inside a VOP COP2 filter.
Edited by Konstantin Magnus - June 7, 2017 17:07:39
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
- Nima
- Member
- 471 posts
- Joined: Nov. 2013
- Offline
- Konstantin Magnus
- Member
- 670 posts
- Joined: Sept. 2013
- Offline
Why dont you scale it down in COPs then? Or change the grid´s expression to something like
res("op:/img/comp1/image", D_XRES) / 10
Edited by Konstantin Magnus - June 8, 2017 05:21:34
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
- Nima
- Member
- 471 posts
- Joined: Nov. 2013
- Offline
- Konstantin Magnus
- Member
- 670 posts
- Joined: Sept. 2013
- Offline
Well, I dont know what you are working on of course, but on a large photo I dont think it would be noticeable.
On the contrary scaling would reduce image errors and noise.
On the contrary scaling would reduce image errors and noise.
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
- Nima
- Member
- 471 posts
- Joined: Nov. 2013
- Offline
- Konstantin Magnus
- Member
- 670 posts
- Joined: Sept. 2013
- Offline
I guess you have to loop through all pixels using either VOPs or python then.
http://www.sidefx.com/docs/houdini/hom/pythoncop [www.sidefx.com]
http://www.sidefx.com/docs/houdini/hom/pythoncop [www.sidefx.com]
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
- Nima
- Member
- 471 posts
- Joined: Nov. 2013
- Offline
- jlait
- Staff
- 6205 posts
- Joined: July 2005
- Offline
With Houdini 16 you can import an image into SOPs as a volume slice in addition to as meshes.
Put a COP Network down in SOPs, point it to your COP network, then set it to Volume Slice.
Then you can use Volume Reduce in Max or Min mode to put the resulting max/min into detail attributes.
You'll notice this generates different results than the attribfrommap solution - I suspect it is mis-applying linearlization somewhere. The volume solution seems correct.
You can also do this entirely in COPs.
Dilate/erode will act as a maximum/minimum in a square region depending on sign of the operation. Ideally you could just set this to 3200 for your 3200x3200 image, but because COPs tries to compute the overscan this gets too expensive. So instead do two passes. First dilate/erode by 128. Then scale by 1/64 which will be safe - you won't miss any max/mins because each max/min already got spread everywhere in 128 tiles. Now do another dilate/erode and get a solid patch of colour for use elsewhere in COPs.
Put a COP Network down in SOPs, point it to your COP network, then set it to Volume Slice.
Then you can use Volume Reduce in Max or Min mode to put the resulting max/min into detail attributes.
You'll notice this generates different results than the attribfrommap solution - I suspect it is mis-applying linearlization somewhere. The volume solution seems correct.
You can also do this entirely in COPs.
Dilate/erode will act as a maximum/minimum in a square region depending on sign of the operation. Ideally you could just set this to 3200 for your 3200x3200 image, but because COPs tries to compute the overscan this gets too expensive. So instead do two passes. First dilate/erode by 128. Then scale by 1/64 which will be safe - you won't miss any max/mins because each max/min already got spread everywhere in 128 tiles. Now do another dilate/erode and get a solid patch of colour for use elsewhere in COPs.
- Nima
- Member
- 471 posts
- Joined: Nov. 2013
- Offline
- Nima
- Member
- 471 posts
- Joined: Nov. 2013
- Offline
-
- Quick Links