Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to control scale invariance?

I am trying to put several diagrams together in a kind of a table. I think this is called "index print", photography people do that when they have to review many photographs at once. Anyway, this is the code:

main :: IO ()
main = mainWith @(Diagram B)
     $ (tile . fmap renderOne) examples

renderOne :: AnyGraph -> Diagram B
renderOne (AnyGraph gr) = ...

tile :: [Diagram B] -> Diagram B
tile xs = let columns = (ceiling . sqrt . fromIntegral . length) xs
          in (vcat . fmap hcat . List.chunksOf columns) xs

It does not work as I expect. But let us approach it gradually. First, here is a render of a single tile:

one

Now, let us hcat four tiles together.

hcat

Add a second row: (See how scale invariant features thicken.)

tile2

And this is how it looks with 4 rows:

tile

Out of hand!

It seems to me that scale invariant features, such as arrow heads, are scaled in proportion to the area of the picture. But in this case, I need to grow my diagram without re-scaling those features. How can I achieve that?

like image 584
Ignat Insarov Avatar asked Oct 28 '19 11:10

Ignat Insarov


People also ask

What is scale invariance in economics?

Scale invariance is a term used in mathematics, economics and physics and is a feature of an object that does not change if all scales in the object are multiplied by a common factor.

What is meant by scale invariant?

In physics, mathematics and statistics, scale invariance is a feature of objects or laws that do not change if scales of length, energy, or other variables, are multiplied by a common factor, and thus represent a universality.

What is scale invariant in image processing?

Scale-Invariant Feature Transform (SIFT)—SIFT is an algorithm in computer vision to detect and describe local features in images. It is a feature that is widely used in image processing. The processes of SIFT include Difference of Gaussians (DoG) Space Generation, Keypoints Detection, and Feature Description.

Why is PCA not scale invariant?

Principal components are not scale invariant because a scale chance in one of the variables leads to a change in the shape of the swarm of points in the sample.


1 Answers

The user manual section on measurement units is what you want to look at. Things like arrowheads are by default measured in "normalized" units, which are scaled so that they are always a constant proportion of the size of the whole picture. If I understand your use case correctly, I think you probably want to use local units instead. Use the primed variant of whatever arrow function you are using, and give it an options record something like

(with & headLength .~ local 0.1)

but with whatever number makes your pictures look the way you want. See the arrow tutorial for more on arrow options.

like image 114
Brent Yorgey Avatar answered Oct 08 '22 10:10

Brent Yorgey