I'm very new to image processing in Python (and not massively adept at python in general), so forgive me for how stupid this may sound. Im working with an AI for object detection, and need to submit 1000x1000 pixel images to it, that have been divided up from larger images of varying lengths and widths (not necessarily divisible, but I have a way of padding out images less than 1000x1000). In order for this to work, I need 200 pixel overlap on each segment or the AI will pick may miss objects.
I've tried a host of methods, and have either got the image to divide up using the methods suggested in Creating image tiles (m*n) of original image using Python and Numpy and how can I split a large image into small pieces in python (plus a few others that effectively do the same techniques in different words. I've been able to make a grid and get the tile names from this, using How to determine coordinate of grid elements of an image, however have not been able to get overlap to work in this, as I would then just tile it normally.
Basically what I'm saying is that I've found one way to cut the images up that works, and one way to get the tile coordinates, but I am utterly failing at putting it all together. Does anyone have any advice on what to do here?
So far I've not found a direct approach to my end goal online - and I've tried mucking around with different scripts (like the ones listed above), but feel like Im barking up totally the wrong tree.
i am creating a game using pygame and python.
i have develoved a square that goes up and down, flows a path.
how do i set a particular path for the square?
My question is how do i take this image and convert it into a path equation the square follows?
Any other idea to use this or any track from an image is appreciated.
i tried imread() of matlab and many other things. i dont think grayscale applies here. i even tried superimposing it on a grid and plot points along the track.
i am out of ideas and from all the vedios i have seen i am missing something very basic here i think. any help?
So I've been making a game using Python, specifically the PyGame module. Everything has been going fairly well (except Python's speed, am I right :P), and I've got a nice list of accomplishments from this, but I just ran into a... speedbump. Maybe a mountain. I'm not to sure yet. The problem is:
How do I go about implementing a Camera with my current engine?
That probably means nothing to you, though, so let me explain what my current engine is doing: I have a spritesheet that I use for all images. The map is made up of a double array of Tile objects, which fills up the display (800 x 640). The map also contains references to all Entity's and Particles. So now I want to create a a camera, so that the map object can be Larger than the display. To do this I've devised that I'll need some kind of camera that follows the player (with the player at the center of the screen). I've seen this implemented before in games, and even read a few other similar posts, but I need to also know Will I have to restructure all game code to work this in? My first attempt was to make all object move on the screen when the player moves, but I feel that there is a better way to do this, as this screws up collision detection and such.
So, if anyone knows any good references to problems like this, or a way to fix it, I'm all ears... er.. eyes.
Thanks
You may find this link to be of interest.
In essence, what you need to do is to distinguish between the "actual" coordinates, and the "display" coordinates of each object.
What you would do is do the bulk of the work using the actual coordinates of each entity in your game. If it helps, imagine that you have a gigantic screen that can show everything at once, and calculate everything as normal. It might help if you also designed the camera to be an entity, so that you can update the position of your camera just like any other object.
Once everything is updated, you go to the camera object, and determine what tiles, objects, particles, etc. are visible within the window, and convert their actual, world coordinates to the pixel coordinates you need to display them correctly.
If this is done correctly, you can also do things like scale and otherwise modify the image your camera is displaying without affecting gameplay.
In essence, you want to have a very clear distinction between gameplay and physics logic/code, and your rendering/display code, so your game can do whatever it wants, and you can render it however you want, with minimal crossover between the two.
So the good news is, you probably don't need to change anything about how your game itself works. The bad news is, you'll probably have to go in and rewrite your rendering/drawing code so that everything is drawn relative to the camera, not to the world.
Since I can't have a look into your code, I can't assess how useful this answer will be for you.
My approach for side scroller, moveable maps, etc. is to blit all tiles onto a pygame.Surface spanning the dimensions of the whole level/map/ etc. or at least a big chunk of it. This way I have to blit only one surface per frame which is already prepared.
For collision detection I keep the x/y values (not the entire rect) of the tiles involved in a separate list. Updating is then mainly shifting numbers around and not surfaces anymore.
Feel free to ask for more details, if you deem it useful :)
I am working on an OpenGL project where I need to be able to click on stuff in 3D space. As far as I can tell gluUnproject() will do that job. But I have heard unexpected things might happen, and the accuracy will be thrown off. It could just be that these people used it wrong, or something else. Is there anything unusual I should know about gluUnproject()?
I once asked a question, which contains what you seem to be searching, click here to see my question.
But basically what you can use gluUnproject() for is to calculate 2D Screen Coordinates (Probably Mouse Coordinates) to 3D World Space Coordinates.
Then you can calculate two points. The first point could be the point on the near plane and the second point could be at the far plane, thereby you can create a line which you then can use to perform collision detection with.
The above images comes from a post (click here to see the post), the post actually describes and tells about probably what you seem to be seeking.
I've got a bounding box, and I want to adjust it so it's not less than, say, 2km across. I get the bounding box from google's geolocate service, and then I search for stuff that's inside that in my database, but I want to make sure I don't test against anything smaller than 1 or 2km across.. I'd like to get the area, measure the with, height, and expand pivoting on the center in case it's needed.
I already have all the SRID and stuff right.
Thanks
The answer to this depends on the SRID. You call expand which gets a unitless float as a parameter, and the units on that depend on the units with which the SRID is defined.