thoughts, ponderings, experiments & recent things
very salient and useful tips by Tom Goskar. Take a look.
If wanting to export shape files from cloud compare (useful for tracing features) and use shapefiles in other programs, you will need a .prj file (projection file).
You can get one by saving a shp file from one of the other programs (e.g. QGIS, photoscan/metashape) and copy and rename it to match your cloud compare shapefile.
Make sure it is the correct coordinate system.
if you import a shape file into photoscan/metashape and it’s not visible, but you really think it should be
good chance that it’s missing
a) a prj file
b) z values
if a) see other post, if b) you can see them in ortho/dem view still, and provided they relate to a coordinates system that matches an existing DEM (e.g. traced in GIS from a vertical DEM) you can project into 3D space. (might be messy). Other options include projecting into 3D in GIS or transforming using cloudcompare or CAD (see other post.. possibly)
<inProduction (i.e. working draft)>
The above image is an excerpt from a pilot project by the University of York. An interesting project, with some super nice people to work with, and tons of potential for future work and experiments. To get a better idea of the project as a whole take a look at the project website. https://hiddendepthsproject.wordpress.com.
What I want to discuss here is an approach to one aspect of one part of the project that I was involved in. For that you need to know that the project looks at human evolution, emotions and modern preconceptions/misconceptions of the human past.
As I say, an immensely enjoyable project. But those familiar with discussing the past outwith the academic realm will know it, any attempt at depicting people in the past is fraught with challenges.
One does not need to look far to find contention with depictions of the past and our preconceptions of the past are hard engrained. Take the case of cheddarman for example, and the slow but steady trickle of stories rehabilitating the humble Neanderthal. But how do we present people (and proto-people), who are unquestionably strange and alien to us in a way that are relatable, while at the same time avoiding the difficult waters of identity politics, unconscious prejudice, balanced representation, the limitations of the archaeological record etc.?
In my view the Kennis brothers do a corking job at creating that sense of relation and empathy (look at their website, they make beautiful things), as does Elizabeth Daynes, and I’m forever a fan of the rich and immersive drawings of Eric Carlson.
But such detailed depictions can become snared in some of the unknowable questions presented by the archaeological record and become mired in modern socio-political tensions as this twitter thread shows (warning it is twitter). What alternatives are there then to generate both a sense of connection, without falling foul of modern prejudices and misconceptions? (Take a gander at this Natural History Museum page). How can we use and depict the archaeological record to question these misconceptions of the past and ourselves without reinforcing stereotypes or becoming bogged down in the details? And how might it be done without the superb skill of the artists mentioned above.
Below are examples from a recent attempt to navigate these tricky waters and a brief explanation of the ideas behind them.
Silhouttes and shadow figures have long been used in puppetry and story telling. A … <todo>
This style, it should be admitted, takes more than passing inspiration from the excellent game Limbo.
2: Depict them how they depicted themselves (kind of).
We know of figurative art from the Upper Paleolithic dating back to 40-60 years ago (exciting area of research with dates under revisal). Depictions of people vary from stick-like figures in rockart to intricately carved ivory statuettes. Abstract forms that are as far from the hyper-realistic reconstructions often sought after by museums. Yet these carvings and paintings capture a sense of character and what is to be a person that we can relate to regardless of the time gap. One favourite mine is the carving in ivory from Brassempouy. Thought to be from around the time of the last glacial maximum it is not only charismatic, but to my eyes at least elegantly gender non-specific.
We know ourselves and others in details. Hands, feet, arms and ankles all carry character and immediately relatable. We are close to them our whole lives and many of us are looking at one or other of them most waking moments.
An aide memoir. Maybe be re-written in time.
Got data in Photoscan? Want to map them in a way that looks beautiful printed in 2D? Want that same data in to live in 3D? Not got CAD?
It can be done with QGIS with a little help from CloudCompare.
Orthoimages and Dems on vertical planes (defined by 3 points) can be digitized in Photoscan or QGIS, and the shape files transformed through cloud compare to end up in QGIS or Photoscan as need.
Which is best depends on preference. I (currently) like QGIS’ symbol flexibility while working. Easier to keep track of entities.
You will need 3 points for your plane, 0,0 , x,0 and 0,y. You can set these and should be on a right angle.
Transform in CloudCompare is simple with point-picking translation command between the drawing pins and the full coordinates.
Use console to copy the transform and apply to shapefile lines as needed.
NOTE: when going from QGIS -> photoscan (a.k.a metashape), a prj file is needed – simply export a random shape from photoscan and rename the .prj file to the one you’re importing.
When going from photoscan -> QGIS, probably need to save as 2D shapefile, but haven’t tried this.
Excerpts, test images and bits from the cutting room floor.
Many congratulations to my colleagues on their discovery and detailed work on the earliest remains of a bready thing yet to be discovered, and for it being picked up by the news!
Almost ready with the prints for the art market.
Well it’s done (and hopefully in time for printing before the market). A horizontal wander through york taking pieces form here and there, some of the things that make York York. The minster, the trees, the old old shops and the modern. Houses both grand and small are in there somewhere.
Of course there’s much much more that could go in and it doesn’t quite fit the original grande plan but for that there needs more time, and space!.
Here it is in all it’s inProduction glory.
Home test of the compostable plant based plastics for wrapping of cards.
According to the manufacturer they should compost in a normal garden compost. According to some, they only compost in industrial composter.
So far – certainly degrading in my healthy home compost (just a black bin with the bottom cut off).
2 months sat on the top, and it’s already very friable to touch. Not worked out how to test it’s not just breaking into micro plastics though. For that I may have to take the manufacturers’ word.
The picture below shows some compostable plastic (centre) that readily fell apart with a poke, some accidentally included real plastic (now removed and not degraded in anyway) and some wooden curtain rings that went in around the same time as the plastic packet.
Fair to say it’s not the fastest substance to ferment through, but the odd wrapper here and there looks like it should be digestible for the humble bucket-o-worms.
(re-release of old post)
The peptide sample, filtered out from the eraser is analysed in a MALDI-ToF mass spectrometer. More information on this later, but what’s important is the sample needs to be prepared first, partly to do with particle charges (we’ll get to this), but also because these machines contain a vacuum chamber and you can’t put a liquid sample in a vacuum chamber… or rather you can, it’s just not advisable if you want to find it.
Preparing and delivering the sample
The first step is to place the liquid on a sample plate. These plates have lots of little circles in a grid, so that you can keep track of your sample. Each sample is spotted out onto several different circles in different areas of the plate. Testing multiple spots helps identify and minimise any anomalies or machine errors. To each spot a drop of an acidic compound is added, this is the M (matrix) in MALDI-ToF, and then it is left to dehydrate. Over time the liquid evaporates leaving the peptides behind and causing the acidic compound to crystallise around them. Now solid the sample can be placed into the machine without worrying about it boiling off into the vacuum chamber.
The solid sample needs to be taken from the plate and turned a gas, but not just a gas, it needs to be a charged gas. Unfortunately the peptides are not naturally charged which is where the acidic compound (or matrix) really assists in the process. A pulsed laser is fired at the sample. The wavelength of the laser is such that the matrix absorbs the energy readily while the peptides do not. This means the peptides are unharmed, but their crystal prison is blown apart into a hot cloud of electrons, protons and all manner of bits and pieces, and the peptides are released in their gas phase. This is the D (desorption) part of the process. It’s thought that at this stage many of the bits of the shattered acid become charged – ionised – during the vaporisation process and the cloud that comes off includes many H+ ions (a lone proton) that readily bond with peptide structures. The protons are tiny subatomic particles that are in the centre of an atom, and the atoms themselves are tiny in comparison to the peptide.
This extra, unmatched proton means the peptide becomes charged and the process happens at random. This is another reason to take multiple readings form a single sample as each laser blast may charge more of one type of peptide than another by chance. By taking more readings it is possible to reduce the effects of chance on the readings. If a particle has charge it can be moved around by electro-magnetic fields, so the cloud of peptides can be pulled into the ToF part of the machine.
Inside the sample droplet is a snowdome like cloud of glitter. These are meant to represent the peptides, themselves colourless reflecting their surroundings. This is of course a trick as they wouldn’t really be visible but they are added as an aid and subject to focus on. The glittery appearance (simple 2-tone 2D planes freely rotating) a nod and a wink to the glittery appearance of the dried samples while the yellow mirrors the true colour of the acidic matrix added to the sample.
There wasn’t the time to make a real life time-lapse of the sample dehydration which is one reason the sequence is animated. The animation is largely an act of imagination alone and made by sculpting a smooth ball into different key shapes before applying a re-meshing modifier with increasing strength create the angular appearance. The sequence has a few idiosyncrasies to it, specifically the way that the crystallised edges continue to reform, but over all it doesn’t compare too unfavourably to video of crystallising droplets I’ve come across later.
Another simplification is the laser blast, where the pulsing has been left out as quickly flashing video is not always a good idea. As the laser is fired the sequences zooms in on the charged peptides, showing them in the same skeleton structure form as the previous sequence. As they become charged they are drawn as having a yellow halo. This is to distinguish between charged and uncharged peptides and show graphically that in the cloud there is a mix of both. As the peptides are pulled away by an imaginary magnetic field they go out of focus becoming yellow dots to make a link with the next sequence where brightly coloured dots make animating the movement easier to follow than the hard to see grey peptide.
The parchment sample, safe and snuggly secure wrapped in eraser particles can be kept without risk of decay for some time, but to get the results it has to be extracted from its polymer home. To do this a solution with the enzyme trypsin is added and the sample warmed to the enzymes functioning temperature ~ 37°C for 4 hours. If 37°C sounds a familiar temperature it’s no coincidence as trypsin is a common enzyme used in digestion.
The animation may look quite straightforward, but for me it is probably the most bamboozling stage to think about… so there’s a lot of writing below.
There are a couple of things going on here. Firstly the collagen strands are being released from the eraser particles, and secondly these strands are broken apart, first into gelatine, and then cut up by trypsin into parts called peptides, but it’s a little more complicated than that.
As we learnt in the previous post the collagen is left clinging to the eraser as a result of static electric charge. When the solution is added to the sample this attraction and bonding begins to give way. Adding the liquid surrounds the samples in a dense sea of molecules, bringing with them their own charges and electrons that interact with the proteins and polymer, effectively neutralising the charge imbalance between them. Heating the sample also has an effect. Introducing energy into the system causes the molecules to vibrate, jig around and knock into each other (try this if you like) causing the eraser to relax, denature and uncurl and helping the collagen and polymer to separate and diffuse into the solution to be digested.
The fibres that make up skin (such as parchment) are thick bundles of collagen proteins which are themselves tight bunches of long chains of amino acids and peptides (short amino acid chains) that are bound to other long chains in a triple helix form. To get a more visual description of this last sentence at look at this video which was a helpful aid to the sequence used in the ZooMS video, or the 3D model on this page.
The warm solution acts as a solvent to the collagen, breaking the hydrogen bonds that hold the triple helix together and splitting them into long gelatine threads – the clear gooey stuff used for making gummy bears, or the jelly in pork pies. At the same time that this is going on the enzymes, as enzymes do, bond to particular points along the length of these chains, splitting them further into the peptides that are needed for the ZooMS method.
Different materials will respond to the heat differently, the molecules in the liquid are relatively free and able to move around and bounce about while those in the protein chains are tied together by attractive forces, with the long chain only able to jiggle around like an angry worm. Eventually some of the bonds will break as attractions between molecules are interrupted by things in the liquid (such as enzymes). To abstract this a little, imagine the scene a bit like 3 giant parallel conga lines that get caught up in a rave, at first they will stay together, but before too long the more freely dancing crowd will lead to lines parting and eventually breaking up into dancing couples.
At the end of this process we’re left with few bits of eraser sat in a soup of peptides and enzymes that can be run through a very fine mesh to sieve out the larger molecules leaving us with only the peptides.
There’s really quite a lot going on here and at sizes that are tricky to get your head around. To stuff it all into a short animation is perhaps a little optimistic, so like the earlier sequences there have to be simplifications.
Lets start with the scales. Now, some molecules can form very large structures, but even so it is very difficult to see their form and requires much more magnification than the kind of SEM that can show the collagen strands in skin. While scanning tunnelling microscopy (STM) can let us ‘see‘ (and animate) individual atoms and thus structures of some molecules, most of the images we have of molecules are models, theoretical constructs developed to represent the behaviour of molecules. As you can see from some of the images and videos linked above these models are often simplified to different degrees depending on the interaction that is being explored or shown. This is true here, the triple helix is portrayed as 3 simple long spirally tubes at the start of the sequence, but the closeup window shows a series of interlinked angled objects (the peptides). In reality these are all shapes of convenience. The lines between corners of the angular shapes represent invisible forces binding atoms together and these atoms themselves are not hard blobs as often depicted, but clusters of even tinier particles orbited by a system of electrons… kind of… if you’re interested Richard Feynman is a good in to the bamboozling world of the frightfully small, paragraph 4 of this page sums it up quite well.
The shape of the triple helix too is simplified. For a start the video only shows the disentangling of a single collagen triple helix separating off the eraser, when in reality there are great bunches of these proteins unravelling. To give an idea of the kinds of scales, imagine focusing on a single tiny strand of hemp in large ships hawser as it breaks and frays in the midst of a heavy storm. The difference in scale between the unravelling fibres of that single thread, the thickness of the rope and the ship it is breaking free from are immense, not only that but simulations suggest the collagen doesn’t simply unravel but come apart and rebind repeatedly before finally coming undone. All in all a very chaotic and confusing scene.
There is also no depiction of enzymes in the animation, instead the focus is on the breaking of the gelatine into peptides, introducing a shape that is returned to in the next animation. This cutting action is important and enzymes are often depicted as scissors chopping up molecules despite looking quite different. If we were to be strict on scale too our view would be obscured by the myriad molecules of the solution everything is floating in.
style and assembly
The desaturated look is continued from the previous sequence, another nod toward the microscopic world where colours begin to loose their familiar meaning. The style is not an accurate depiction but one that tries to simplify things (see above) in a way that is approachable, but retains some of the drama of the event and the key features of the collagen-gelatine-peptide sequence. Computer based molecular modelling that produces more accurate depictions of processes is quite advanced but requires specific software and produces results that are a little harder to understand for the uninitiated. Try an internet search for videos of ‘molecular dynamics‘ to get a better idea of what these molecular simulations look like.
The objects in the scene are very simple, 3 spirals, a blob and a few randomly moving spheres in the background, but behind the scenes are hidden objects that bring it all to life. Central to the animation are the collagen strands. These simple spirals appear to wrap around one another but are kept in separate layers so that they can’t interact. Each spiral has its own rig of forces that pull it apart. Using forces adds unpredictability to the animation where a few subtle changes of settings produce very different results. There are 3 forces for each each with a limited range of influence. The first is closest to the spiral and approaches from below, tugging at the spiral and pulling it out. Too strong and it causes the whole spiral to collapse, working alone and the thread gets in a bunch that follows the force along. This is where the second force comes in, intersecting with this first, it plucks the thread out a little only for it to then be spun out further by a third ‘turbulance’ force. The forces of each spiral are set slightly differently and follow subtly different paths to give an uneven unravelling.
All the while the chain jiggles. This is done using armatures – the same kind of animation bones used to move the sheep. There are 2 sets of armatures, the first a series of short repeating bones that jiggle back and forth and move the spirals, the second a large armature of longer bones that bend this first set, turning it from a curve to a straight line.
One caveat of using this force and armature approach is that the forces don’t like to move around a changing curve, so instead of having them move round in a changing spiral that comes away from the blob of eraser, the forces move in one while the spirals straighten up into their path and the blob moves off. At the same time the camera rolls and turns to give the impression that the spirals are moving as much as the blob.
The last thing was to give a sense of the threads dissolving into the liquid, a simple camera trick of setting a shallow depth of field and adding a touch of motion blur, throwing the wide moving close-to camera sections into a milky blur.
I’ve included an early draft of this unravelling in a video below and a few screen shots with the forces drawn on to explain.
(re-release of old post)
The triboelectric effect discussed in the previous post is shown in another animation – a closeup up of someone gently rubbing the eraser over the surface of parchment. Once again, the emphasis is on how very low impact the sampling technique is, and that it is only tiny microscopic strands of parchment material – ones which are already loose – that are collected. This is in stark contrast to other methods that may require segments of parchment to be cut out and sent away.
what’s going on
Parchment – a form of processed animal hide – is made up of millions of strands of long chains of a protein called collagen all interwoven in a tangled multilayered web. As the eraser builds up a charge and passes over these strands it attracts them toward it. However, most of the chains are woven in place by one another, so while any loose ends may reach up like excitable grass as the eraser approaches, they fall back down again when it passes away. Among this large web of fibres there will be some that are loose. These are drawn up form the surface by the charge and cling to the eraser surface.
The polymer of the eraser is very soft, and while the gentle rubbing does no damage to the parchment, the eraser begins to break apart along the edge resulting in the familiar crumbs of “erdu” that are still covered in the loose collagen strands, making it very easy to collect these microscopic samples.
What’s more, most of these small blobs of eraser are actually tiny little spirals, the curling most likely a combination of the surface charges along with differential stretching of the polymers that make up the eraser. This type of curling may be familiar with if you’ve ever curled the end of a bow on a present by dragging scissors along a ribbon. These tight spirals trap the proteins, locking them away from light, oxygen and other things that may cause the sample to denature over time and so greatly increases its shelf life.
styling… why its all grey.
First of all, lets talk about colour. Although parchment looks yellow, collagen strands themselves are grey. This is the first reason the sequence is in black and white. The second relates to the scale. When looking at structures this small in the real world we need to use techniques such as SEM – Scanning Electron Microscopy. SEM detects surface structures using a beam of electrons, rather than magnifying an image in visible light like optical microscopes. As a result they cannot produce colour images in the conventional sense but result in detailed grey images. Beautiful coloured SEM images are increasingly common these days, but they are coloured in, either for aesthetic effect or as a key to show specific properties.
This animation also has a lot of grain or noise compared to the others. This is a reference to the static that is so important in the collection process. Originally the sequence had more noise added to it in post processing, but was removed due to problems with compression artefacts when preparing the video for the web. A practical upside to this style was to speed up rendering time by lowering the number of samples the blender rendered carried out. Some of the images on this page have been rendered with more samples to give you a now-noise view of the setup.
At this scale the real situation would be much more complex with other substances littering the parchment surface such as dirt, dust and bacteria (but not such that it affects the results of the technique). The eraser too is quite stylised. If we were looking at it at the same scale as the collagen we would not have a sharp edged smooth surface as depicted in the animation but something more pitted and uneven, perhaps like this SEM. The size of the eraser tail would also be much longer and the pieces that come off would be much more complex. But all these things are secondary, the aim of the animation is to show what is happening to the collagen in the parchment being sampled.
the making of.
The collagen strands and surface of the parchment are made from the same type of particle simulator used for the sheep hair. Layers of simulated hair were stacked on top each other to provide depth, and brushed in different directions with one layer allowed to interact with the attractive force field that follows the eraser.
To model the eraser tip, bending and stretching as it drags over the surface was a little more tricky. A softbody cube was created, the mesh adjusted to allow sufficient deformation to get the desired effect without giving the software too many calculations to work out. In the end the cube was subdivided toward the tip and the material weight painted to prevent the top of the model from deforming and reducing the number of faces involved in any calculations. There was still a lot of tweaking required to get the right kinds of tension, spring etc in the material and a few other touches including as a wave deform effect was added to create a subtle vibration across the surface to hint at the friction between the two surfaces as they bond and separate.
A simple trick was used to create the curling spawl that comes off the eraser – a method where you deform one object to the shape of another. In this case a flat cube subdivided to give places it can bend along, smoothed then pushed into an invisible coil shaped box or lattice.
Some images showing the sequence from different viewpoints and the underlying meshes are shown below along with some early concept models. The next instalment looks at unravelling the collagen.
(re-release of od post)
This is probably the most important part of the ZooMS video, and even the ZooMS process. The original concept was by Matthew Collins of the University of York, keen to highlight how truly gentle the sampling method is. It made its first outing to coincide with a publication about the new process, you can see more with these links.
Most people will be familiar with the buildup of small electrostatic charges in their daily lives, such as the crackles and pops you get when taking off a wool jumper, but the most evocative example has to be the balloon-on-hair trick. The creation of the static charge when rubbing two materials together is called the triboelectric effect – tribo coming from the greek word τρίβω to rub. What is happening to cause this build of charge is the two materials, balloon and hair (or eraser and parchment), undergo a temporary bonding when they touch. During this bonding the electrons are shared across the interface. Pulling the materials apart breaks the bonds but not all of the electrons that have been shared out are returned to their original owners, with one material leaving with more electrons than it started with and the other with fewer. In this instance it is the balloon that comes away with an electron profit.
Rubbing back and forth, repeats this bonding and breaking process over and again, which builds up the amount of charge imbalance.
In a way you could think of it a bit like taking 2 sprinkle topped cakes and touching them together, but one of these cakes is stickier than the other. When you pull them apart some of the sprinkles get swapped from one cake to the other.
The sheep in the video is a wensleydale sheep, a particularly hairy bread of Ovis aries picked out by Matthew for its long curly locks of wool that resemble the spirally molecular form of collagen – the protein that is sampled in the ZooMS process. More on this in later posts.
The model of the sheep is very basic. Fundamentally it is a group of simple spheres and cubes that have been lightly sculpted and all tied together with some armatures – or animation bones, not the best way to build a sheep, but effective for this purpose. The hair of the sheep is a mix of different particle simulators. These particles – the hairs – can be affected by forces, wind, gravity, attractive forces etc, making the animation of the hair relatively simple. The only trick is to make sure the balloon only moves the hair you want it to move, and that when it falls back it falls over, rather than through the sheep. This is done using invisible collision objects.
For a more advancedBlender.org sheep, check out Frank, by the fine folk of the Blender community in their 2015 animation short Cosmos Laundromat.
(re-release of old post)
At last, the ZooMS video has come out of the virtual work shed and released into the wild. ZooMS stands for – Zooarchaeology by Mass Spectrometry and is a method for identifying animal species from tiny samples without damaging the original sample. You can find out more by watching the video here or going to these articles.
To accompany the video I’m writing a few posts about the making of the video, specifically the animations, going into more detail about the science behind each animation as well as how they were made and some of the stylistic and artistic decisions taken along the way. The models themselves are all quite simple, but hopefully this paradata will be useful or interesting to some interested, even if the methods used may not be the most efficient or orthodox.
The video is based around sections of footage showing the different stages of the technique, from the very easy sample collection, to the scientific nitty gritty in the lab. Without an on screen presenter it is this lab footage that really sets the overall pace for the video, a video which aims to provide a concise overview of the method to an informed audience of heritage professionals who may consider the using it on their own collections.
At each step of the ZooMS process, the sample becomes smaller. The use and choice of animations is structured around this progression, bringing the viewer closer in to each micro-world, zooming further and further in to emphasise the very small amounts required with this technique but to also try and create a more tangible experience of this unseen world. All the animations are made in 3D (with Blender 2.76) and while each animation has its own character the overall stylistic aim was to was to create a clearly computer-generated and unrealistic appearance, something very simple that would allow for a similar style or thread to be shared across the different sequences. Each animation also has its own requirements to take into consideration that are discussed in more detail later.
Hopefully the posts will be of interest, either from a scientific or an artistic view point. And if you’re a heritage professional with some parchment get in touch with York Uni BioArCh and have it sampled. The more samples there are, the better it gets!
Home made frames for home made photographs.
Overjoyed seeing people’s reaction to this humble veg at the art market, and especially chuffed by the kind folk who bought a print. (1 of only 2 that shall ever be).
York seasons – work in progress.
Small video offshoot from the making of a piece for the 2018 York River Art Market
Error details: Some materials definitions were not found, a default white material is used where no material was available.
Anyone dealing with 3D models through photogrammetry or modelling programs who use the wonderful Meshlab or Cloud Compare programs may have come across the above error.
The cause of this is down to the programs not being fully happy with spaces in file names and their material definition files – the .mtl file.
To fix the issue remove all spaces from files names, edit the .mtl file and .obj files in a text editor accordingly.
When you remove the spaces inside the .mtl and .obj files be sure to remove any quote marks “”.
edit Object file in text editor
mtllib “my file.mtl” usemtl my-file
mtllib my_file.mtl usemtl my-file
edit .mtl file in text editor
… … map_Kd “my file-tex.jpg”
… … map_Kd my_file-tex.jpg
But I didn’t have any spaces…
If you haven’t used spaces in your files and you still have the problem then sometimes programs will include the quote marks “” even if you haven’t used spaces and Meshlab and CloudCompare will still fail.
Recently have taken to using custom scalebars with coded targets when photogrammetric modelling with Agisoft Photoscan.
Detecting targets is automatic, importing coordinates is automatic. Currently, importing scalebars is not.
Here’s a very basic Python script from importing scalebars and setting their value.
# script for automatically creating and importing scalebars from a csv file. # format must be # modified from script for making scale bars from the camera # pair with the following naming convention: "NM_links..." + "NM_rechts..." by Alexey #compatibility PhotoScan Pro 1.3.2 import PhotoScan from PySide2 import QtCore, QtGui doc = PhotoScan.app.document chunk = doc.chunk print("Create and import scalebars") msg = "Choose a scalebar csv file" path = PhotoScan.app.getOpenFileName("Select input text file:") file = open(path, "rt") eof = False line = file.readline() while not eof: #split the line and load into variables point1, point2, dist, acc = line.split(",") #iterate through chunk markers and see if there is a match for point 1 if (len(chunk.markers) > 0): for marker in chunk.markers: if (marker.label == point1): scale1 = marker #iterate through chunk markers and see if there is a match for point 2 for marker in chunk.markers: if (marker.label == point2): scale2 = marker #create a new scale bar between points if they exist and set distance scalebar = chunk.addScalebar(scale1,scale2) scalebar.reference.distance = float(dist) nopair = 0 else: nopair = 1 else: nopair = 0 if nopair: print("Missing one or other end of point") else: print("no markers") #reading the next line in input file line = file.readline() if not len(line): eof = True break file.close() PhotoScan.app.update() print("Script finished")