Getting image from COP HDA Subnet [Solved]

   3054   2   0
User Avatar
Member
23 posts
Joined: April 2013
Offline
EDIT: This has been solved! Grab Houdini 16.5.525 or higher to be able to use this.

Hey guys! I'm doing a little experiment and need a sanity check. Haven't been able to find a whole lot of information, so I'm wondering if anyone's here looked at this.

So, I have a COP Subnet HDA that's simply loading an image. However, when I try to extract it to memory and write it out to a file or have Qt load it, it looks completely washed out. Does this code look like the right method for a simple image extraction through COPs?

HAPI_CookNode( this->session, this->assetNode, &this->cookOptions);
HAPI_RenderCOPToImage(this->session, this->assetNode);

int bufferSize;
HAPI_ExtractImageToMemory(this->session, this->assetNode, HAPI_PNG_FORMAT_NAME, "C A", &bufferSize);

std::vector<char> data;
data.resize(bufferSize);
HAPI_GetImageMemoryBuffer(this->session, this->assetNode, &data.front(), bufferSize);

Regarding writing out, I'm just using ofstream:

std::ofstream file(outputFilePath);
if( file )
{
    file.write(&data.front(), data.size());
}

Notes: I attached a sample of the output. I also haven't looked through the data of the image itself to see what is exactly missing.
Edited by sburrichter - July 24, 2018 12:04:58

Attachments:
uv_test_grid.png (279.5 KB)
image_data.png (224.0 KB)

User Avatar
Member
571 posts
Joined: May 2017
Offline
Could you try with Houdini 16.5.525 or newer? We might have fixed this recently.
User Avatar
Member
23 posts
Joined: April 2013
Offline
Looks like that did the trick! Thanks guys! Attached a screenshot of the result with Qt reading the memory output. Image discrepancy is due to some leftover settings that I'm too lazy to change

Attachments:
Screen Shot 2018-07-24 at 8.59.16 AM.png (410.3 KB)

  • Quick Links