I'm currently working on a ML project with the HoloLens 1 and aiming to process a video taken by the front camera. Therefore I need to access the camera data from my c# Unity project. I assume there must be a way to store this in some data type(Tensor/Array/...).
I found several ways to store videos or pictures directly to the disc but none for directly using the data in my program. There might be a possibility to firstly save the video to the disc and afterwards access the saved data from my program, but that seems quite computing-intensive.
Do you have any suggestions how to make the data of the images available in the program?
You can definitely save the picture frame to memory, you can start with PhotoCapture class to capture the picture and stored as a variable. Please refer to this link to learn more about how to use it: UnityEngine.Windows.WebCam.PhotoCapture.
And the key point is when you call the async method TakePhotoAsync(onCapturedPhotoToMemoryCallback), you need to pass in a function as a parameter, it will be invoked once the photo has been stored to memory. And in this function, you will get an PhotoCaputrerFrame instance as a parameter that contains the image captured from the camera.
Related
I want my android application record live audio from microphone and add my own binary data as image frames. I will be recording board game and whole image can be saved to around 50 bytes. The content should be possible to stream online so I want to put the data to some standard media container.
I checked various classes but can't build it together.
In MediaRecorder and AudioRecord classes I miss functions to add any sort of special data / tracks.
In MediaMuxer I can't find on the other hand a way how to record live, seems to me it only combines existing tracks.
Am I missing something in classes mentioned above? Or can this thing be done with MediaCodec and MediaExtractor? I don't much understand how these should be used.
Link to existing code would be welcome, I can check on my own, I just don't know where to search for the answer.
I developed a socket based p2p system where i stream mp4 video from a client to a server. The video data are transferred using byte[].
The transfer works, however i am struggling to figure out how i could play, in continuous, a mp4 file being transferred to another PC? The PC application, that would play the file, is in WPF.
I tried using a MediaElement to play the file, being written to the disk, but for some reason it doesnt play at all. I can play it with VideoLan tho.
Any hint of where to look? I am lost from here!
Thanks in advance!
Its going to be different with every player. Mp4 is probably the worst possible container for this application. The container is designed to be used with random access media, such has a hard disk. The player has the ability, and sometimes requirement to seek around within the file, and not just plat start to finish. Either you need to make the protocol mp4 aware (parse the file, and download the block that will most like be needed next), or use a streamable container such as TS, or flv.
Its is also possible that the player knows the file is incomplete. The atoms sizes are encoded within the file. If the file size doest match, the combined atom sizes, the player could assume a corrupt file.If this is what is happening, you can try to pre allocate the file. it may trick the player enough to play
I need to capture audio data from the computer mic, process it and then plot it in real time. Processing each frame will produce a 1-D array which I want to display in an image where each value in the array is mapped to a color. The next audio frame is processed similarly and is then displayed on the next row of the image and so on. In matlab, one can achieve this using imagesc function. I also want the user to be able to scroll up and down to see current or previous data.
I believe I will need to buffer the processed data in a file or database and then asynchronously update the plot as mentioned above.
I'm trying to achieve all the above using C#.
My question is: what is the best way to generate the image/plot? I've done a lot of research (Microsoft Chart, VTK, several codeproject articles..) but couldn't find exactly what I want.
Also, what would be the best database to use in such case?
I do not think that there is a component that does exactly the things you've described. In most frameworks/bundles all the images get visualized by native system calls (in the end) which accept strides, buffers and so on, driving all by HANDLE. So, either you generate next time new image with new rows or just draw it yourself by stacking prev image to new one.
Scrolling (AKA windowing) is not trivial but possible again with already pre-created image in memory which is fixed. However, please note, that GDI+ based images (.NET Bitmap) is kind of limited for more than 9000px size. Please consider using alternative like IPP, AForge images.
I recommend you draw rows yourself because in your task re-sizing in going to be an issue because of rows bluring.
So, all in all, you might need to do it yourself.
The application is written in C#. It uses nHibernate and SQLite and runs on Windows. I should store pictures and bind them to a user.
So far, I don't really know what is the best way to store the pictures. If I decide to store the path of the picture and save the image in a directory, I'll have problems as soon as the directory or the file is renamed or moved. In the other hand, storing image as BLOB in SQLite is slow as I have to "cast" the image into a bytes array before storing and when I retrieve, I have to set the bytes array into an image.
What is the recommended way for this?
I wrote an image user type for this purpose. With it, you just pass the Image object, not its bytes: http://weblogs.asp.net/ricardoperes/archive/2009/09/17/nhibernate-image-user-type.aspx.
I'm using the Xzing lib to capture barcode images, and I'm wondering where do those images get stored if there is no pre-defined or optional destination selection option?
Is the captured image just temporarily stored in the applications isolated storage untill the application terminates/ is in a closed state or what?
Based on a quick look at the code, it appears that image are only held in memory and it is up to you to save to IsolatedStorage if you wish to persist them that way.