tricky COPs: Crop image by its alpha?

   440   10   2
User Avatar
Member
438 posts
Joined: Feb. 2016
Offline
I'm trying to figure out a way to get rid of the blue area.
Is there any way I can use the alpha channel (shown on the right) to crop the image? (without leaving COPs. Can't use any SOP trickery )

thanks for any help!
project file attached
Edited by Andr - Nov. 19, 2018 17:01:39

Attachments:
cropbyalpha example.JPG (43.7 KB)
Q_cropByAlpha.hiplc (104.7 KB)

User Avatar
Member
1826 posts
Joined: June 2008
Offline
Try dropping down a crop node.

Attachments:
Untitled-1.jpg (73.1 KB)

Using Houdini Indie

Windows 7 32GB AMD FX8370 @ 4.1Ghz
nVidia 1070GTX 8BG RAM. Driver: 397.31
User Avatar
Member
438 posts
Joined: Feb. 2016
Offline
Unless I miss something it doesn't seem to read the alpha.
I need the crop to happen automatically, without typing in value by hand.

cheers
User Avatar
Member
285 posts
Joined: Jan. 2015
Offline
i do stuff like this in sops
hightfields are quite cool for that. You can iterate quickly over them and find coordinates that are.
trace-sop might also help
User Avatar
Member
438 posts
Joined: Feb. 2016
Offline
Doing in sop should be easy, but my (limited) experience with COPs tells me that it wouldn't be good for efficiency, especially if you deal with multiple high-res images; and it would also add a layer of instability to the system (more prone to crash).



Slightly related:
I need to feed a parameter of a COPs node with a specific pixel value from another node.
Is there any hscript function that I can use in parameter to retrieve the value of a pixel? I can't happen to find it.
I've found only a VEX function in the docs, but I don't really understand how and where to use it:
http://www.sidefx.com/docs/houdini/vex/cop_sample_suite.html [www.sidefx.com]
My convoluted workaround so far: I create a plane with the solid color of the pixel I want to read, export it to SOP and read the Cd attribute from Sop with a point() function. It works, but it's slightly imprecise and very unstable.
Edited by Andr - Nov. 20, 2018 05:09:53
User Avatar
Member
4018 posts
Joined: July 2007
Offline
Andr
I need to feed a parameter of a COPs node with a specific pixel value from another node.
Is there any hscript function that I can use in parameter to retrieve the value of a pixel? I can't happen to find it.
http://www.sidefx.com/docs/houdini/expressions/pic.html [www.sidefx.com]
or if you need more options
http://www.sidefx.com/docs/houdini/hom/hou/CopNode.html#getPixelByUV [www.sidefx.com]
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
438 posts
Joined: Feb. 2016
Offline
thanks!
User Avatar
Member
593 posts
Joined: July 2005
Offline
tried to find a COP that could be misused to do this, no luck.

really need a wrangle COP with an equivalent to detail (run once)… and writable crop & window sizes.

Attachments:
bbox.hiplc (301.5 KB)

User Avatar
Member
1826 posts
Joined: June 2008
Offline
I don't think After Effects can do this either. You can pre-comp something but you must manually set the size of the pre-comp.

I could see it being possible in SOPs using an attribute from map, followed by a delete and a bound.

You could probably do this using ImageMagik and some PHP code too.

Why can't you use SOPs?
Edited by Enivob - Nov. 22, 2018 10:43:28
Using Houdini Indie

Windows 7 32GB AMD FX8370 @ 4.1Ghz
nVidia 1070GTX 8BG RAM. Driver: 397.31
User Avatar
Member
438 posts
Joined: Feb. 2016
Offline
cpb
really need a wrangle COP with an equivalent to detail (run once)… and writable crop & window sizes.
that would help to easily store some attributes and recall them.


I've been trying to use the suggested pic() function, but I did something wrong apparently, it seems to be able to read it but Houdini becomes unresponsive in my system. Like it's being sucked into some computation loop. Have to kill Houdini every time.

Do you understand what is broken?
See attached .hip
Edited by Andr - Nov. 22, 2018 11:21:18

Attachments:
Q_COPs_readPixel.hiplc (100.3 KB)
readpixelwrong.JPG (88.4 KB)

User Avatar
Member
438 posts
Joined: Feb. 2016
Offline
Enivob
Why can't you use SOPs?


This back-and-forth between SOP and COP seems to me an additional step that would slow down the cooking, especially if you want to proceed with multiple highres image. So I tend to avoid when possible.
But that's just based on my limited experience with COPs
  • Quick Links