-
Notifications
You must be signed in to change notification settings - Fork 49
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
How to Access Image Data in C++ (not save to disk) #18
Comments
Hey, I will try to answer your question, but I am not sure if I understand correctly what it is you are trying to achieve, which is why it may point towards a different direction...
yes, but there are two things to be kept in mind:
So basically if you leave out all implementation from the "Save Image Data to Disk" section, you are left with the I hope this somewhat clarifies :) Otherwise, please feel free to follow up 👍 |
Thanks for your response. You answered my question perfectly. For now, I am just trying to implement the full code from your repo to test out saving to disk, just to make sure everything is working before I make the changes I want to. I get an error when I implement the code from the Override the Tick function of the CaptureManager section. Do you know what might be causing the error and how I can fix it? Full code for CaptureManager.cpp: https://gist.github.com/dilne/715162238d4c3487ababc991f75fe483 |
Good to hear! Regarding the code - sorry, that should have been fixed a long time ago.. I must have missed that one in the readme.. I will update it right away. |
Awesome! Thanks for your help! I also had to update the following code to
Now to test, how do I call the CaptureColorNonBlocking() from the level blueprints? What should I search for from within the blueprint to do this? I think maybe your screenshot of the blueprint didn't upload under the bit where you say: "For testing purposes we can call the CaptureColorNonBlocking() from the LevelBlueprint by attaching it to a button pressed event." Thanks again for all your help! Interestingly, even though my code wasn't working last night, I just checked my Saved folder and it seems I have an image saved that was created last night, I'm not sure how that happened! |
Note that there are 2 separate CaptureManagers used in the above example :D |
Yea that's the thing with C++ in unreal... |
Thanks for the tip! I saw from your plugin code that you implemented the following:
I implemented this and now UE no longer crashes and I see this error message in the logs! So now I need to understand why the CaptureComponent is not valid, any ideas on where to start? |
Alright, that is a start. You do have an |
I have dragged my CaptureManager into the scene and added a SceneCapture2D to the scene. I then click CaptureManager in the World Outliner and under Capture > Color Capture Components I select SceneCapture2D1, which is the Scene Capture 2D that I previously dragged into my scene. I'm assuming this is what you mean by connecting them? I don't need to do something like create a render target do I? Or is there some kind of setting on the SceneCapture2D that needs to change? |
Yes, that is what I meant. All setup of the Ok now I see.. sorry this is the result of me switching the functionality of the CaptureManager while writing the tutorial.. |
At least I think that will be it |
Yes, you got it!!! My output is a bit janky though! Changing to .png fixes it nicely however. Thanks for all your amazing help! I'd like to thank you in some way for your kindness, patience and for putting this repo up. Often I'm speaking to coders/developers on LinkedIn and I 'endorse' some of their coding skills under their skills section when they've been a great help. I'd happily do the same for you if you'd like or something else, let me know. I'll be sure to give this repo a star either away! |
Yes, awesome! the 'janky' artifact you are seeing is/might be jpeg compression. Make sure to always use png (lossless compression) to store labels. You are very welcome, this stuff working for you is enough for me. I remember the struggles to get this together very well and I am glad to help! 👍 |
Hey, rather than selecting a SceneCapture2D that I drag into the scene, do you know how I can select the SceneCapture2D if it is a component inside a blueprint class? I'd like do to this because the blueprint class contains blueprints that make the SceneCapture2D follow the player character. |
In that case, maybe I would make an actor reference in the actor (blueprint?) that your SceneCapture is a component of, and pass it the CaptureManager actor. This is almost always possible because many classes inherit from AActor eventually. |
So I've create an actor object reference in my actor BP (called CapManRef) that my SceneCapture is a component of. I then pass in the CaptureManager actor via the Details pane. Therefore, I believe the casting should work in theory, but then when trying to set the Color Capture Component I see that because my SceneCapture is a component it therefore isn't compatible. Do you know how I can fix this please? |
You should be able to access the component with this, after all, it seems actors are merely containers of components |
Hi,
Apologies for the newby question. I have a 2DSceneCapture component that I have very simply made to follow an actor. I want to access the data from the scene capture in C++ so I can do some postprocessing with the image. I don't want to save to disk however.
Is this code under the Setup A ColorCapture Component section in your read me assigning the raw image data from the scene capture to the variable renderTarget2D? So my question is, is this render target basically holding the image data?:
Thanks in advance
The text was updated successfully, but these errors were encountered: