VIA annotation tool json output file for UNET - image-segmentation

I would like to know how to use VIA (VGG annotation tool) for generating Binary masks for Unet architecture to work.
I generated the JSON file, after manually annotating the objects in an image. I would like to use UNET for doing image segmentation task after annotating. As my input will be the original image and ground truth image.
Ground truth image which is binary masking image, which can be generated after annotating. I am currently stuck, on how to generate binary masking image, from VIA JSON annotated file. Kindly advice.
Thanks

Related

Kinect v1 with Processing to .obj to unity [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I want to create an hologram that is exported via the kinect to an hololense. But it's very slow.
I use this tutorial to collect point cloud data, and this library to export my data as a 3D object in .obj format. The library that exports obj doesnt accept points so I had to draw little triangles. I save the files .obj .png and .mtl on my local xampp.
Next, I download the files with a unity script and WWW object. I also use Runtime OBJ Importer from unity's asset store to create a 3D object at runtime.
The last part is to export the unity app on a hololense. (I will do it next).
But before that,
The process is working but is very slow. I want the hologram to be fluid. A lot of time is wasted :
take depth and rgb data of the kinect
export data to an obj png and mtl file
download the files on unity as frequent as possible
render the files
I think of streaming but does unity need a complet obj file to render ? If I compress .png to .jpg will a gain some time ?
Do you have some pointers to help me ?
Currently the way your question is phrased is confusing: it's unclear wether you want to record point clouds that you later load and render in Unity or you want to somehow stream the point cloud with the aligned RGB texture in close to realtime to Unity.
You initial attempts are using Processing.
In terms of recording data, I recommend using the SimpleOpenNI library which can record both depth and RGB data to an .oni file (see the RecorderPlay example).
Once you have a recording, you can loop through each frame and for each frame store the vertices to a file.
In terms of saving to .obj you'll need to convert the point cloud to a mesh (triangulate the vertices in 3D).
Another option would be to store the point cloud to a format like .ply.
You can find more info on writing to a .ply file in Processing in this answer
In terms of streaming the data, this will be complicated:
if you stream all the vertices it that's a lot of data: up to 921600 floats ( (640 x 480 = 307200) * 3)
if you stream both depth (11bit 640x480) and RGB (8bit 640x480) images that will be even more data.
One option might be to only send the vertices that have a depth and overall skipping points (e.g. send every 3rd point). In terms of sending the data you can try OSC
Once you get the points in Unity you should be able to render a point cloud in Unity
What would be ideal in terms of network performance is a codec (compressor/decompressor) for the depth data. I haven't used one thus far, but doing a quick I see there are options like this one(very date).
You'll need to do a bit of research and see what kinect v1 depth streaming libraries are out there already, test and see what works best for your scenario.
Ideally, if the library is written in C# there's a chance you'll be able to use it to decode the received in Unity.

How to convert `mapbox.mapbox-terrain-v2` tiles to heightmap tiles?

Mapbox provides a kindle of map tiles--mapbox.mapbox-terrain-v2 which is stored in pbf format and saved in mvt suffix. The height data is represented by contour (line).
I want to generate terrain with satellite texture and this height data in Unity3D. How could I convert this pbf data to a height map(a pixel for a height value)?
There is an example
https://api.mapbox.com/v4/mapbox.mapbox-terrain-v2/12/1171/1566.jpg?access_token=pk.eyJ1Ijoib2xlb3RpZ2VyIiwiYSI6ImZ2cllZQ3cifQ.2yDE9wUcfO_BLiinccfOKg
And the mvt file
https://api.mapbox.com/v4/mapbox.mapbox-terrain-v2/12/1171/1566.mvt?access_token=pk.eyJ1Ijoib2xlb3RpZ2VyIiwiYSI6ImZ2cllZQ3cifQ.2yDE9wUcfO_BLiinccfOKg
And the document of Mapbox:
https://www.mapbox.com/vector-tiles/mapbox-terrain/
https://www.mapbox.com/vector-tiles/specification/
MapBox have buid a Unity3d package: MapBox-Unity-SDK
SDK here : https://www.mapbox.com/unity/
Just click download.
This is an asset you can open in Unity directly.
Launch Unity3d, goto Menu>Assets>ImportPackage>CustomPackage
and select your downloaded file.
It will unpack some files and the folders, you will find into some exemples scene files to help you.
The current vector terrain layer isn't designed to be turned into a heightmap: we've processed terrain into elevation contours and lines, so turning those back into raw data would be difficult (much like doing the opposite: we do a lot of processing because it would also be difficult to transfer raw data and derive visual data).
A new and improved vector terrain model that supports your usecase is on the way, but we've also introduced RGB terrain, which was actually designed specifically to address cases like Unity - decoding the RGB-encoded elevation tiles tends to be much simpler in software.

Matlab - Center of mass of object having only its edge

I'm trying to make an object recognition program using a k-NN classifier. I've got a bunch of images for the training part of the classifier and a bunch of images to recognize. Those images are in grayscale and there's an object per image. The problem is that there's only the edge of the object (not filled), so I don't think using regionprops(img,'centroid') will work properly for what I understand...
So how can I get their center of mass?
xenoclast's answer should be quite clear, just to add something extra.
As you are done creating the binary image from the grayscale image of yours using im2bw; if the edge of your the object is a the boundary that covers the object fully, you may use regionprops(bw,'centroid') directly without going through imfill.
The first step would be to binarise the image with im2bw. Then you can use imfill(img, 'holes') to turn it from an outline into a filled solid. After that regionprops will work as expected.

Image filter to separate ricegrains

I am trying to solve an image filtering issue with MATLAB 2013a. Here are two images on which I am trying to work.
My aim is to obtain each rice grain as a separate image.
Following is the process I used and was successful for the first image.
Convert to gray scale,
Obtain grey threshold,
Convert to binary,
Perform dilation and erosion for more accurate filtering,
Use connected component analysis with bwconncomp,
Save each component.
Now if I try to achieve similar binary image for image2, all the rice grain connected to each other comes as a single component.
I have tried to derive edge map with 'canny' or any other like 'sobel', its not working.
Can someone please guide me to achieve this.

Using Haar features for cascade object detector MATLAB

I am trying to use the vision.cascadeObjectDetector (MATLAB) to detect heads from a CCTV footage(and not faces). Till now, I have tried the following:
Used vision.cascadeObjectDetector to detect faces.
trained it to detect a sign (an example shown in read me file)
created a folder with positive & negative training HEAD images & same for testing
tried to create a .mat file using trainingImageLabeler (although it gave me an error when trying to pass it as param to the object detector).
Can someone try to put me in the right track, to start detecting heads using Viola-Jones Haar features please?