IMHO, this will be too slow. Firstly just getting the bitmap will be slow, then looping through all the pixels will be a slow operation.- Extract RGB values of each pixel vector Data ()?. I think this format Data Ybr.
-Loop through all the pixels for values. Do you think that will be too slow? Can you capture less resolution to go faster?
All this should make about 20 times per second. Is it too much effort for a phone?
Look at the GetPixels function of the ImageUtils class of my Accelerated Surface library.What I need is to use a function to extract color of some pixel in the image, just like GetPixel(x, y).
What I have to do now is to save the data() array to a file with cameraEx.SavePictureToFile(data, dir, filename). Than I have to open it again with LoadBitmap or LoadBitmapSample. And now I have a Bitmap object where I can use GetPixel.
No way to that process directly on data() array?
Look at the GetPixels function of the ImageUtils class of my Accelerated Surface library.
Informatix, I did not found a solution with your AS library.
What do you mean? That you do not find the function in the library? Or it is not suited for your needs (so what are your needs because your initial request was to get the color of each pixel of an image)?
I use without any problem the getpixel function. My problem is to get and android.graphics.Bitmap from the byte array data() in YUV format that you get from the _PictureTaken (Data() As Byte) event from Camera.
At the moment the only way I have found is to save the Data() byte array with the camera.SavePictureToFile(Data, folder_name, file_name) fuction, that generate a jpeg file. Than I have to open it again with LoadBitmap or LoadBitmapSample. So I obtain an android.graphics.Bitmap where I can use a getpixel function. But it is a very slow solution.
My question is:
1) is there a way to use a getpixel function directly on the Data() byte array?
or 2) is it possible to add to the Camera object a function like .PreviewImageToJpeg, able to process the full size image that comes from the _PictureTaken event?
or 3) any other solution to process directly data stream from the camera as fast as possible?
Ok I see. What result did you get when you pass your byte array to your Camera1_Preview sub (and pass it directly to InitializeFromBytesArray since the data are already in JPG format)?
Note that GetPixel and GetPixels are two different functions and I wouldn't use GetPixel to get all the pixels of an image because it's horribly slow.
The _Preview event is generated by the Camera, and what I have done in preview is to use the .PreviewImageToJpeg function to convert the Data() byte array
why don't you reuse the same code for the data coming from the PictureTaken event? What result do you get?
You should read the first post again.do you think JordiCP will share that code?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?