Hello OpenCV experts!
I’m currently working on an Android Kotlin project where I’m dealing with a CV Mat that I’ve converted into a blob using the
blobFromImage function. The purpose of this is to create a linear array by unwrapping in the H,C,W format, as required by a subsequent block of code. The process involves permuting the dimensions and then unwrapping them.
Here’s a summary of my approach:
- Convert a CV Mat into a blob using
- Permute the dimensions to obtain the H,C,W format.
- Attempt to unwrap the blob data using the
getfunction into a float array.
The issue I’m facing is that even though the blob seems to contain non-zero values (as I can see in the original CV Mat), when I use the
get function to unwrap the data into a float array, all the elements in the float array remain as 0.
I’ve considered an alternative approach of looping through the blob values and unwrapping them one by one, but I’m unsure about how to access the individual values within a blob using OpenCV functions.
Could anyone shed some light on why the
get operation is not working as expected? Additionally, any guidance on how to correctly access and unwrap the values within a blob would be greatly appreciated. Here’s a snippet of my code for reference:
// Convert CV Mat into blob val input = FloatArray(1*256*256*3) var temp = Dnn.blobFromImage(imageMat) Core.transposeND(temp, MatOfInt(0,2,1,3), temp) temp.get(0, 0, input)
Thank you in advance for your help and insights!