Ask Your Question

Nikolaos's profile - activity

2018-12-21 05:39:02 -0600 received badge  Famous Question (source)
2017-07-06 04:15:56 -0600 received badge  Notable Question (source)
2017-05-12 01:21:52 -0600 received badge  Popular Question (source)
2016-12-22 13:37:34 -0600 commented question Losing alpha channel when passing from Unity to OpenCV?

Sorry for the delay (too much paperwork), not using imdecode doesn't seem to work, here are 5 steps from the debugging process (it shows with imdecode - which works and without imdecode - which deosn't work with some info from the vs debugger) https://s30.postimg.org/j3hqd5601/Ste... https://s30.postimg.org/ndwe8qb35/Ste... https://s30.postimg.org/hr4mozxy9/Ste... https://s30.postimg.org/meaoqrlb5/Ste... https://s30.postimg.org/fp45aqzz5/Ste...

note at step4 the "prevAllocator=????" , it doesn't look right.

2016-12-21 06:53:43 -0600 commented question Losing alpha channel when passing from Unity to OpenCV?

I tried that but the third party application crashed. After debugging the DLL visual studio gave me this message

Unhandled exception at 0x00007ffa401dc58a (opencv_imgcodecs310d.dll) in Unity.exe: 0xC0000005: Access violation reading location 0x000000002476d000.

at

line 831 : memcpy(png_ptr->row_buf + 1, row, row_info.rowbytes);

2016-12-21 06:21:47 -0600 commented question Losing alpha channel when passing from Unity to OpenCV?

I found a solution by replacing the lines

std::vector<uchar> vectordataImMedium(imMedium, imMedium + imMediumLength);

cv::Mat data_mat_medium(vectordataImMedium, true);

mediumImage = cv::imdecode(data_mat_medium, 1);

with these

cv::Mat imgBuf(cv::Size(1280, 960), CV_8UC4, imMedium);

mediumImage= cv::imdecode(imgBuf, CV_LOAD_IMAGE_UNCHANGED);

Thank you again for time and your interest.

2016-12-20 23:34:53 -0600 commented question Losing alpha channel when passing from Unity to OpenCV?

Than you for your time and for your answer. I performed a similar test and the result agree with your test. I still wonder if there is something wrong in my c++ code in the way that I construct data_mat_medium from buffer and in the decoding process. Also I think it's unfair for the question to be downvoted for mentioning the C# side of the code. I present the c# side to show that just before sending the image, this image really had an alpha channel and I think that this is important. I can remove the unity and c# stuff from the question if it is better for everyone. I apologize again and thank you one more time.

2016-12-20 13:04:31 -0600 received badge  Editor (source)
2016-12-20 13:01:32 -0600 asked a question Losing alpha channel when passing from Unity to OpenCV?

Hello, I'm trying to develop an educational application using Unity3d and OpenCV (c++ Dll). My problem is that when I pass an image from unity encoded in PNG (in BGRA32 textureFromat) to OpenCV, if i save the image through OpenCV it looks like alpha channel is removed. Alpha channel is critical in some 'heavy' OpenCV-side operations for my application and this removal is disastrous.

This is what i get by saving the image from Unity (there is a transparent border) before sending it to OpenCV dll image description

This is what i get by saving the image from OpenCV image description

Here is the relative portion of the c++ code

public void saveIncomingImageArray(uchar * imMedium, int imMediumLength) {

         std::vector<uchar> vectordataImMedium(imMedium, imMedium + imMediumLength);

     cv::Mat data_mat_medium(vectordataImMedium, true);

     mediumImage = cv::imdecode(data_mat_medium, CV_LOAD_IMAGE_UNCHANGED);

     cv::imwrite("From Opencv1_medium.png", mediumImage, compression_params);

}

compression_params are defined just before the saveIncomingImageArray function
and here is the c# code respectful

//Create a texture2D to pass data from rendertexture with BGRA32 format

    Texture2D textMedium = new Texture2D(rtMedium.width, rtMedium.height, TextureFormat.BGRA32, false);

    textMedium.alphaIsTransparency = true;

    textMedium.Apply();

//fill texture2D with data from rendertexture - function defined in my code elsewhere

    RenderTextureToTexture2D(ref rtMedium, ref textMedium);

//create the array to pass to OpenCV

   byte[] imageMedium = textMedium.EncodeToPNG();

I think I need some help or some guidance, Thank you.

2016-08-28 15:22:43 -0600 commented answer Opencv 3.1 and Visual Studio 2015 (cannot open file 'opencv_calib3d310d.lib')

I managed to make it work, I copied opencv_world310.dll to project's directory and added opencv_world310.lid to additional dependencies. Thank you for your help!

2016-08-28 01:59:38 -0600 commented answer Opencv 3.1 and Visual Studio 2015 (cannot open file 'opencv_calib3d310d.lib')

I will try some windows/VS2015 specific search first for these issues and then I will give feedback.

2016-08-28 01:48:56 -0600 commented answer Opencv 3.1 and Visual Studio 2015 (cannot open file 'opencv_calib3d310d.lib')

thank you very much for your answer but after linking I get Loaded 'C:\Users\Administrator\Documents\Visual Studio 2015\Projects\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe'. Symbols loaded.

'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.

'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.

'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.

'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'. Cannot find or open the PDB file.

'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. Cannot find or open the PDB file

2016-08-27 19:05:23 -0600 received badge  Student (source)
2016-08-27 18:07:23 -0600 asked a question Opencv 3.1 and Visual Studio 2015 (cannot open file 'opencv_calib3d310d.lib')

Hello there, I followed the Installation by Using the Pre-built Libraries article (I didn't make my Own Libraries from the Source Files), the Set the OpenCV enviroment variable and add it to the systems path article (the link to pathEditor was dead so I downloaded form somewhere else) and the How to build applications with OpenCV inside the "Microsoft Visual Studio" article using the local method, with the provided code example but I get an Error LNK1104 cannot open file 'opencv_calib3d300d.lib' . I really cannot understand where the problem is. I also noticed that

1 opencv_calib3d300d.lib

2 opencv_core300d.lib

3 opencv_features2d300d.lib

.....

lib files do not exist in my pre-built library. I'm on x64 platform in my Solution and in Debug mode, and logged in as administrator. Thank you.