Say, I have some images drawn on screen, like in any average XNA project. Is it possible to make it so that only a selected array of triangles of the image is visible? Here's an example:
The red lines outline the triangles in the array. The blackness is completely hidden from view.
I tried googling and didn't find anything, so I hope this is even possible.
If you want to make a mask like that, you could have a sprite that's the exact shape of the blackness (bonus if you make that shape dynamic ;)). Have it drawn in a layer above whatever you want to hide.
You can use the VertexPositionTexture class.
Then use a mask consiting of a VPT for each triangle in you array to reveal the parts of your texture you want visible.
An example of how you can use it:
enter link description here
Related
example image
after image
how to find rectangle region in image?
It can be not exactly.
i tried to use "CvInvoke.findContours" but i failed because don't know how to use.
please tell me what should i do
i need function that return region rectangles, or some hints please..
sorry and thanks.
You'll want to create an image where the regions that you want are highlighted and the regions you don't want are black. To do this, I would do an adaptive threshold (you'll want to convert the image to black and white and then use the invert threshold option to highlight the non-white areas).
Then I would use morphology (dilation followed by erosion, or 'closing') to remove the noise. The image should now have white blobs on the regions you're interesting in and be black elsewhere. The final steps will be find contours, follows by looping over each contour and finding their bounding boxes.
You'll want to read up on each of these topics, but that approach should work for what you want. Opencv's documentation isn't great, and EmGU's bindings adds another layer of confusion, but be patient and you'll get the hang of it.
Adaptive threshold:
https://docs.opencv.org/3.3.1/d7/d4d/tutorial_py_thresholding.html
Morphology: https://docs.opencv.org/2.4/doc/tutorials/imgproc/opening_closing_hats/opening_closing_hats.html
find contours:
https://docs.opencv.org/2.4/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=findcontours#findcontours
bounding rect:
https://docs.opencv.org/2.4/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=boundingrect#boundingrect
here is the link that contains
shape detection using emgu.
I have a bunch of images, that look like .
After processing, I want them to be like .
I know that I can easily make those black areas white using the Flood Fill algorithm. But first of all I need to make sure that the black area is not part of the text. How can I do that? Those areas are huge, comparing to letters. So maybe I can just find out the size of each black area, and make the areas which are bigger than n white?
That's all about machinevision.
You could write your own code for something like "Connected-Component-Labeling"
This is just one possible approach.
Therefore you could start at the top left corner and gather all pixel that have almost the same grey value. save the coordinates and fill this area if the array contains more pixel than a certain threshold.
But i think you ll have some probs with the black "line" in the middle.
I am very curious, I have for example a app to localize our property, our first, second house, favorite park and we can add pushpins to corners of this property in a way to form a shape(triangle, square, polygon etc), not a line or point.
How to create this shape, there is a method to calculate the surface area? Change a background for example to color yellow between these pushpins ?
When we created a shape we can chose from the listbox or map to delete this shape or go to there using GPS, i wrote something like that in Simulate my current position
I think its a interesting app but i need your help ;)
Try getting the geocoordinates of each pushpin and using maths? I guess you could assume the flatness of the Earth over a small area (like a house) but over larger you'll need to account for curvature.
As for colouring the shapes in, I don't think there's a way to do this using the Map control.
Hello I need to know how I can manage to resize and draw pictures in a given space and the top and left values are stored in a database or XML. What elements need to use?
I put pictures of the software that works to perfection, really need to create something like what is shown in the following images:
Imagen 2
Imagen 3
Thanks!!
You probably want a canvas with a resizing adorner that tells the elements what size and placement to draw. Here is one such example.
I want to cut up the image based on various text markers placed around within it. The font/size of the marker is up to me.
I know commercial OCR packages provide this in their APIs but I'm hoping I can code this up myself.
Ideally I wouldn't have to go pixel to pixel and compare against an image of the marker text.
I'm good with C++/C#, Java, PHP and an other language where a library like this exists...
Ideally I wouldn't have to go pixel to
pixel and compare against an image of
the marker text.
Well, if you're trying to find the marker image, then that's exactly what you'd have to do.
Here's an idea... Set the marker text to a particular color, then process the background image to make sure that it doesn't have any pixels of that color. Finding the markers should become a lot easier at that point.
A barcode would be easier to detect than a text marker. You can always place them together, with the barcode being used for automatic position detection and the text for human user.
If you want to do a really sufisticated solution, you could use the hough transform. It is often used for augumented reality stuff - there it is necessary to find a certain marker in an image. Ofc you would have to change your markers a bit, would this be possible? ;-)
The hough will give you the position of your marker lines and thus the area which you want to cut out.
Here is a link about hough, but there are many others though.
Hough
Or this one
Wiki
A fiduciary marker would be better than text. That's what they use for augmented reality and such.
If the text is always the same size, shape, and oriented in the same direction, you could use normalized cross-correlation.
"Ideally I wouldn't have to go pixel to pixel and compare against an image of the marker text."
Well how else are you going to do it? You're only going to search in part of the image?