currently im trying a little bit with object detection. Therefor i already programmed a script which detects my object draws rectangles everytime the object gets detected. So the camera pictures gets colored more and more. Now i want that i get a feedback when a specific area is completly colored.
The specific area is also an cv2.rectangle which i added already. I made a little picture to show what i mean.
Before
The smiliy is my object which hast moved from the right to the left (arrow). The green rectangle ist the area which i want to track. So if inside the green rectangle every spot is inside a red rectangle then the job is done. I made a second drawing which show what i mean.
after
Thank you very much if you have a Idea. :)
Related
Using SceneKit
I want to make the gray transparent box to disappear and only show the colored boxes when the user zooms in.
So I want to detect when that box's edges are starting to fall off the screen as I zoom, so I can hide the gray box accordingly.
First thoughts, but there may be better solutions:
You could do an unprojectPoint on the node and check against screen coordinates, do the +/- math on object size and skip Z. I "think" that would work
You can do some physics based collision detection against an invisible box or plane geometries that acts as your screen edges, has some complexity if your view is changing, but testing would be easy - just leave visible until you get what you want, then isVisible=false
isNode(insideFrustomof: ) - returns boolean on whether it "might" be visible. I'm assuming "might" means obscured by other geometry which in your case, shouldn't matter (edit) on second thought, that doesn't solve your problem but I'll leave it in here for reference.
so I'm making a game and pretty much when the player (which is a triangular shaped rocket) hits an object flying at you (a rock) the game ends. I have everything working well but my problem is the rocket is a triangle yet the image view its in is a rectangle. So if the edge of the image view touches the rock the game will end even though the actual rocket didn't touch the object. So basically how can I make the rock image view not recognize the parts of the rocket image view which are empty? Basically a triangular shaped image view.
Thank you for your help. Let me know if you need more info or want to see the code I have for them to collide.
You analytically present the triangle with 3 points and a rock with a center and radius then find and implement an algorithm checking a hit test between those 2 shapes. Or draw the two shapes onto some graphics context using an appropriate blending and check for overlapping pixels (for instance draw one as red and another as green and look if a pixel that is both red and green exists) you could actually do that with 2 image views having those colors and .5f alpha added on the 3rd invisible view but you would need to get the image from the view and then iterate through all the pixels. In any of the cases do this check only after the corresponding view frames overlap.
I have 2 UIImage's one on top of another and the top one slides and reveals the coloured one. The issue is that I want the indicator (purple line, which is a view) to indicate in the left side only by the end of the image (image`s background is clear).
What I want is to resize that purple line so it wold be visible in the left side and on the image but not on the right side, as it is now.
Any ideas of what I can try ? I have no idea where to start, thank you!
What I did so far:
what I want:
It is possible to implement programmatically using CGImageCreateWithMask, but it is very hard. Also such solution will be not very fast, if you want to do it in real time.
I offer next solution: create 3-d image, as shown below. That picture must be a white mask, which will limit your line. Place that picture above pic 1 and 2. Pink line should also be placed below that picture.
Sorry, if I wrote something unclear.
Thanks kelin, the idea that you gave me was interesting, but I did not had time for that, so I found another way of doing this. I used a third image for the mask witch is an image with the lady`s shape cut off and a white background but only in the right side of the picture (the left half side image and lady shape is transparent), and the line crosses on top of the pictures shown previously and under the image I added with mask...
Simple and efficient, and it uses way less memory for a real time displaying with an animation .
I have an Image of a landscape which i need to fill with different colors.
When i select colors from palette and start scrubbing on any particular part, only that part should get the color even if by mistake i take my finger outside of that image part.
So basically i need to detect which part of image have i tapped so that only that part takes the color.
I am developing this app in Cocos2dx, but any help in logic would be a good point to start.
Here is an example of what i want.
Note : I know i could achieve this by taking separate images and then detecting touches, but that increases the app size by alot of MB's.
I guess user will be able to draw only on white part of the image.
If above is true, what i want you to do is, in your touchesMoved method, check if any black color (non white) pixel is present between previous touch point and current touch point.
If there is no such black pixel, then draw it else dont draw it.
I want to make a little iphone game where the User has to draw over a given line in a image. I know how to do the drawing code when the user touches the screen. But I have no clue how I can detect when the drawn line(s) are for example 95% over a given line in a png image.
An example of this is in the free 'dumb ways to die'-iphone/ipad game. The mini-game where you have to feed the snake by putting mustard on a hotdog.
Tips on how you would solve this problem are very welcome!
Thanks!
The easiest would probably be to have a secondary (invisible) image of the same size that contains just the line, but with a thicker stroke. You could then simply check the pixel color in that secondary image for all the points of the line that is drawn by the user.