How to scatter an image with random size, position, and rotation, without using a pattern fill? (ie, no instance is cut off) - photoshop

Let's say you have an image such as this...
... and you want to quickly and easily scatter it around to create foliage. How would you achieve this aside from using a pattern fill or pattern stamp tool? (Both of which have the problem of abrupt edges.)
This is the sort of result I'm looking for, where none of the instances have cut-off edges, but in a way that doesn't involve me manually copying, scaling, and rotating each and every one.
If there is a way to either paint this with a brush, or even simply click to stamp these where each click results in a single instance of the image randomly scaled and rotated, that would be amazing.
After having used PS my whole life, this is the first time I've needed to do this, and I am baffled that it doesn't seem to exist.

Related

GODOT: What is an efficient calculation for the AABB of a simple 3D model from a camera's view

I am attempting to come up with a quick and efficient means of translating a 3d mesh into a projected AABB. In the end, I would like to accomplish something similar to figure 1 wherein only the area of the screen covered by the cube is located inside the bounding box highlighted in red. ((if it is at all possible, getting the area as small as possible, highlighted in blue, would increase efficiency down the road.))
Figure 1. https://i.imgur.com/pd0E20C.png
Currently, I have tried:
Calculating the point position on the screen using camera.unproject_position(). this failed largely due to my inability to wrap my head around the pixel positions trending towards infinity. I understand it has something to do with Tan, but frankly, it is too late for my brain to function anymore.
Getting the area of collision between the view frustum and the AABB of the mesh instance. This method seems convoluted, and to get it in a usable format I would need to project the result into 2d coordinates again.
Using the MeshInstance VisualInstance to create a texture wherein a pixel is white if it contains the mesh instance, and black otherwise. Visual instances in general just baffle me, and I did not think it would be efficient to have another viewport just to output this texture.
What I am looking for:
An output that can be passed to a shader informing where to complete certain calculations. Right now this is set up to use a bounding box, but it could easily be rewritten to also use a texture. It also could be rewritten to use polygons, but I am trying to keep calculations to a minimum in the shader.
Certain solutions I have tried before have worked, slightly, but this must be robust. The camera interfacing with the 3d object will be able to move completely around and through it, meaning at times the view will be completely surrounded by the 3d model with points both in front, and behind.
Thank you for any help you can provide.
I will try my best to update this post with information if needed.

How to detect street name plates

I have some problems with this assignment. Given an image of a street nameplate, like this one
I have to detect the nameplate and mark it on the image with a rectangle, obtaining something like this:
Nameplates can be rotated, scaled and in different lighting conditions. The procedure must be automatic.
What i have tried so far is to isolate the nameplate from the background. I've tried with different thresholding methods, but the problem is that i have different images and one single method doesn't work with all of them, due to different lighting condition and noise. What i've thought is to perform a pre-processing on the images, to reduce noise and normalize light, but, again, how to choose pre-processing steps that work with every image in my dataset? And what for images that don't need pre-processing?
Another problem is that there might be other signs in the image with writings on them and i have to ignore them. So i've thought i could isolate the nameplate by that blue outline, but i don't know if that can be done(or if it is convenient) with template matching, also considering that part of the outline could be cut off from the image.
So what i'm asking is: is there an automatic way to isolate/detect only that type of nameplates that have the blue outline on them, regardless of orientation, light conditions, shadows on them, noise in the image, etc? What steps would you follow?
Thank You

Drawing "boxes" on my PDF output

I am working on a corporate-level summary report for my employer. Because this is a fairly high-level report, I'm trying to "pretty" it up a bit (I think the standard SAS output is exceptionally ugly). I've managed to include graphics using ODS REGION and the like, but I'm having trouble generating a fairly basic bar chart.
All I want to do is draw boxes onto the PDF file by specifiying X,Y and W,H and the background color. I've gotten close using this SUGI paper (which employs ODS REGION with a PROC GSLIDE).
That works OK, but I've run into many vexing little issues. For example:
There's a minimum height and width for GSLIDE (appx 3 points) which has made it very difficult to represent small numbers on my bar graph
The corners of GSLIDE are slightly rounded, causing strange looking "artifacts" when attempting to overlay and stack them
There's apparently a "maximum" width (appx 480 points). I think I might be able to solve this with the GOPTIONS VSIZE attribute, but I have to be careful because if the ODS REGION and GSLIDE are exactly the same size, then SAS (for some reason) thinks that the GSLIDE is bigger than the REGION and fails to render GSLIDE properly.
I've searched the internet for an easier approach, but it seems there are few SAS programmers trying to do what I'm doing. I know that I'm reinventing the wheel a bit in that SAS providers bar charts via SAS/GRAPH, but they don't provide the level of customization I need to display the results the way I want them.
How can I draw a simple rectangular shape, with nice square corners, and no weird width/height limitations, on a PDF file?
This isn't direclty relevant to the question, but since it's been brought up, here's an idea of what the bar chart looks like:
Each row measures a metric across a mutually exclusive sub-section of a larger population. The Gray bar represents the total size of the population being measured. The blue bar measures the metric (and the reported number is the metric across the sub-section). The "white bar" is the size of the total population. (The light blue bar is an alternate metric displayed only for those who are curious - it will always be smaller than the blue bar.) Some sub-sections contain no data, so they are displayed as "N/A".
There's also a rolling total. So, after one or a few sub-sections are reported, they are rolled into the rolling total. The gray background groups the related sub-sections, with the rolling total reported at the bottom.
This is pretty much exactly what I want this chart to look like. If it can be done using standard SAS charts, I'd be happy to use them - but I think it's been easier to get this effect on my own by painting the graph myself.
I found a partial answer... you can use a LayoutRegion defined via PROC TEMPLATE to set the background color of an ODS REGION. You still must "put something" within the region to force SAS to render it (for example, ODS TEXT = " ";), but it removes at least one pain point: minimum and maximum sizes.
Unfortunately, the corners are still rounded, but I'll update this answer if I can figure out a way to fix that via an attribute or something.

Detecting what percent of an drawn image has been "erased"

Let's say I have a solid, irregularly shaped (but enclosed) shape on screen in iOS (one colour). I then want to "erase" portions of that shape by dragging my finger around like you would in a typical kids colouring app, erasing with a fixed brush size where I touch the screen.
I could easily accomplish all this with something like an image mask and touch detection however, as a requirement, I also need to determine the rough percentage of the shape that remains.
For example I need to know when 50% of the random enclosed shape has been "erased".
What's the best way of approaching this problem? Are there any existing iOS compatible libraries that can handle it? I'm thinking that I would need to keep track of a ton of polygons and calculate all the overlaps but it seems like there must be a solution to this problem.
EDIT: I have done research into this problem however tracking all the polygons manually and calculating all their positions and area overlaps seems overly complicated. I was simply wondering if anyone else has run into a similar issue and found a better solution.
you will need to first know the fixed space of the image view. then you will need to know the percentage of blank space when the new image is loaded. pixel
double percentageFilledIn = ((double)nonBlankPixelCount/totalpixels);
After you get that value you will need to use that percentage as your baseline for the existing percentage
your new calculation will look like this.
double percentageOfImageLeft = ((double)nonBlankPixelCount/totalpixels/percentageFilledIn);
this calculation will likely be processor intensive. I would only calculate sparingly.
Since this post is not about code and more about login I will let you determine your logic for detecting non blank pixels.
here is how to find a pixel color.
How to get Coordinates and PixelColor of TouchPoint in iOS/ObjectiveC
Good luck.

On-the-fly Terrain Generation Based on An Existing Terrain

This question is very similar to that posed here.
My problem is that I have a map, something like this:
This map is made using 2D Perlin noise, and then running through the created heightmap assigning types and color values to each element in the terrain based on the height or the slope of the corresponding element, so pretty standard. The map array is two dimensional and the exact dimensions of the screen size (pixel-per-pixel), so at 1200 by 800 generation takes about 2 seconds on my rig.
Now zooming in on the highlighted rectangle:
Obviously with increased size comes lost detail. And herein lies the problem. I want to create additional detail on the fly, and then write it to disk as the player moves around (the player would simply be a dot restricted to movement along the grid). I see two approaches for doing this, and the first one that came to mind I quickly implemented:
This is a zoomed-in view of a new biased local terrain created from a sampled element of the old terrain, which is highlighted by the yellow grid space (to the left of center) in the previous image. However this system would require a great deal of modification, as, for example, if you move one unit left and up of the yellow grid space, onto the beach tile, the terrain changes completely:
So for that to work properly you'd need to do an excessive amount of, I guess the word would be interpolation, to create a smooth transition as the player moved the 40 or so grid-spaces in the local world required to reach the next tile over in the over world. That seems complicated and very inelegant.
The second approach would be to break up the grid of the original map into smaller bits, maybe dividing each square by 4? I haven't implemented this and I'm not sure how I would in a way that would actually increase detail, but I think that would probably end up being the best solution.
Any ideas on how I could approach this? Keep in mind it has to be local and on-the-fly. Just increasing the resolution of the map is something I want to avoid at all costs.
Rewrite your Perlin noise to be a function of position. Then you can increase the octaves (and thus the detail level) and resample the area at a higher resolution.