luxonis / depthai-unity

DepthAI Unity Library, Unity projects and examples (OAK For Unity)
MIT License
200 stars 34 forks source link

Full resolution Color image #43

Closed BarnabasTakacs closed 10 months ago

BarnabasTakacs commented 1 year ago

Thank you for these very nice demos indeed. I noticed you are visualizing the low-resolution Preview of the color stream.

Is there a way to get the HD or even full 4K resolution from the camera? If so, where do we need to modify it? (At the moment when the Preview is turned off, we get no images at all)

gespona commented 1 year ago

Hi ! yes, usually color image preview is low-res (same input size of NN).

If you want to retrieve full res image, I'd suggest to take a look to the streams example and just modify the pipeline to retrieve full image instead of preview

https://github.com/luxonis/depthai-unity/blob/main/src/device/Streams.cpp

Just change the link from the camera node to output node

That said, I will try to work on the example itself so you can select the resolution from unity interface

balogistvan commented 1 year ago

Hi! Thank you for this repo. Could you describe where it needs to be changed, the size of the image.("Just change the link from the camera node to output node") How to build the files? Because when I try, I always get an error.

gespona commented 1 year ago

Hi @balogistvan

Camera node has preview and normal output

You can find in line 56 of Streams.cpp

colorCam->preview.link(xlinkOut->input);

To build the plugin dll you need to follow the steps here:

https://github.com/luxonis/depthai-unity/blob/main/docs/Build_unity_lib.md

What errors are you getting?

Let me know if this info it's not enough, I will try to make the changes in a branch of the repo

balogistvan commented 1 year ago

Thanks for the answer. I'll try to build it and post the result here.

balogistvan commented 1 year ago

Hello. Now I am getting this error. Could this be because there is no depthai camera connected to the computer?

C:\Users\balog\depthai-unity\depthai-core\include\depthai/device/Device.hpp(67): error C2061: syntax error: identifier 'Device' [C:\Users\balog\depthai-unity\build\depthai-core\depthai-core.vcxproj] C:\Users\balog\depthai-unity\depthai-core\include\depthai/device/Device.hpp(67): error C2238: unexpected token(s) prece ding ';' [C:\Users\balog\depthai-unity\build\depthai-core\depthai-core.vcxproj] C:\Users\balog\depthai-unity\depthai-core\include\depthai/device/Device.hpp(97): fatal error C1903: unable to recover f rom previous error(s); stopping compilation [C:\Users\balog\depthai-unity\build\depthai-core\depthai-core.vcxproj] Generating Code...

And in line 56 of Streams.cpp colorCam->preview.link(xlinkOut->input);

The correct code is:
if (config->previewSizeWidth > 0 && config->previewSizeHeight > 0) { xlinkOut = pipeline.create(); xlinkOut->setStreamName("preview"); colorCam->setPreviewSize(config->previewSizeWidth, config->previewSizeHeight); colorCam->color.link(xlinkOut->input); }

or: colorCam->normal.link(xlinkOut->input); } ?

Is there anything else that needs to be changed? Thank You.

gespona commented 1 year ago

Seems error compilation and it does NOT depends on depthai camera connected or not.

I see some typo here: xlinkOut = pipeline.createdai::node::XLinkOut

To choose another output from the colorcamera node you can check here: https://docs.luxonis.com/projects/api/en/latest/components/nodes/color_camera/?highlight=colorcamera

So in case to retrieve full res image you can use ->isp or ->still or even ->raw

Will try to setup a branch in next days

balogistvan commented 11 months ago

Dear Gerard. Can you upload a verson with full resolution images output? Thank You.

gespona commented 11 months ago

Hi @balogistvan ,

Please check branch https://github.com/luxonis/depthai-unity/tree/full-resolution-streams

As you can see in line 92 of DaiStreams.cs you need to setup resolution.

image

balogistvan commented 11 months ago

Thank You.