In search of the ‘reverse algorithm’

Advert

In search of the ‘reverse algorithm’

Home Forums CAD – Technical drawing & design In search of the ‘reverse algorithm’

Viewing 22 posts - 1 through 22 (of 22 total)
  • Author
    Posts
  • #548028
    Michael Gilligan
    Participant
      @michaelgilligan61133

      First: Please don’t mention the KISS principle !

      I am well-aware that I could draw the item from scratch, in less time than it has taken to compose this post.

      .

      I set myself a little challenge, and I have failed … so I turn to the forum for guidance.

      So far as I am aware, the only available picture of the ‘screwcutting attachment’ for the Jason lathe is here:

      **LINK** http://www.lathes.co.uk/jason/

      I want [want, not need] to fit that image to an Isometric Grid … but no matter how I ‘transform’ the perspective, I cannot get it to align in all three isoplanes at the same time.

      Now: The object has lots of 90° corners, and we know that the movements on a technical camera could square things up [*] … so why can’t I fully ‘de-perspectivize’ the photograph ?

      MichaelG.

      [*]  **LINK**

      https://www.properproof.com/largeformat/Guides/CalumetDigitalGuide1%20(2).pdf

      .

      Edit: Here, for anyone who wants to play, is the photo … re-sized and put on a large ‘canvas’

      .

      33f9543d-7bba-4bee-ad64-fc75fb179591.jpeg

      Edited By Michael Gilligan on 01/06/2021 20:32:24

      Advert
      #21348
      Michael Gilligan
      Participant
        @michaelgilligan61133
        #548050
        Ady1
        Participant
          @ady1

          The silver handle generates an optical illusion which makes it look like it is on the same plane as the 3rd cog

          The 3rd cog which is aligned with the 2nd cog which is aligned with the top cog…

          Edited By Ady1 on 01/06/2021 23:45:20

          #548059
          JasonB
          Moderator
            @jasonb

            Could the image you are working from already have some distortion or have been tweaked by a camera? May even have had the format changed at some time.

            There is also the problem with draft angle on what looks like a cast bracket so your 90deg corners may well be 93 or 87

            #548060
            Michael Gilligan
            Participant
              @michaelgilligan61133
              Posted by Ady1 on 01/06/2021 23:43:41:

              The silver handle generates an optical illusion which makes it look like it is on the same plane as the 3rd cog

              The 3rd cog which is aligned with the 2nd cog which is aligned with the top cog…

              Edited By Ady1 on 01/06/2021 23:45:20

              dont know

              But there are plenty of straight lines to define rectilinear/orthogonal features

              The first step in my work-flow was to trace over some of the reasonably clear ones.

              … one very obvious set being the edges of the nameplate

              MichaelG.

              #548062
              JasonB
              Moderator
                @jasonb
                Posted by Michael Gilligan on 02/06/2021 07:21:07:

                Posted by Ady1 on 01/06/2021 23:43:41:

                The silver handle generates an optical illusion which makes it look like it is on the same plane as the 3rd cog

                The 3rd cog which is aligned with the 2nd cog which is aligned with the top cog…

                Edited By Ady1 on 01/06/2021 23:45:20

                dont know

                But there are plenty of straight lines ……………………………

                … one very obvious set being the edges of the nameplate

                That does look the best for two planes, front to back is not so easy to find a long straight pair, probably top and bottom of the motor mount plate as they seem to be the only two on the same plane assuming the top edge is parallel to the bottom?

                #548063
                Michael Gilligan
                Participant
                  @michaelgilligan61133
                  Posted by JasonB on 02/06/2021 07:06:19:

                  Could the image you are working from already have some distortion or have been tweaked by a camera? May even have had the format changed at some time.

                  There is also the problem with draft angle on what looks like a cast bracket so your 90deg corners may well be 93 or 87

                  .

                  Good point, Jason yes

                  … that potential ‘tweaking by a camera’ is basically what prompted my title for the thread.

                  In principle, I think it should be possible to ‘undo’ that which has been done.

                  [ Light travels in straight lines ]

                  My plan was to do the perspective correction based on ‘known’ features … which, if it had worked, might have revealed that draft angle. But, using 4-corner ‘free transform’ I still can’t get it anywhere near isometric.

                  … I must be missing something !

                  MichaelG.

                  #548066
                  Andy Carlson
                  Participant
                    @andycarlson18141

                    I've tried something not entirely dissimilar when trying to find dimensions for railway vehicles and buildings that are no longer with us.

                    My first attempts involved measuring the photo and trying to use trig to determine the unknown dimensions from the one that was least uncertain. I thought it should be simple but I could not make it simple or get it to produce sensible results.

                    My approach now is to take advantage of the fact that I need to make a drawing anyway and then create a 3d model in whatever tool, export it to STL and then import that to Blender. With Blender I can then guess the relative position of the camera and the subject, guess the focal length of the lens and attempt to reproduce the perspective in the photo. The photo can be imported as a background and I can move the opacity slider to compare the two. The same model can be used to overlay multiple photos from different angles if you have them.

                    Blender takes time to learn but overlaying a photo onto an existing STL is using a tiny part of its features so you only need to learn those parts.

                    See below for an example of a building. It's the Steam Packet Inn in Hayle and was demolished in the 1960s.

                    I have not tried to use isometric projection as an interim step TBH.

                    steam-packet-blender-overlay.jpg

                    #548067
                    Martin Connelly
                    Participant
                      @martinconnelly55370

                      This is tweaked, I haven't spent a lot of time on it so it could be done better.

                      jason3.jpg

                      It was rotated 3° to get the verticals correct then pinched about 10% to get the parallels more parallel followed by a 105% vertical stretch.

                      Martin C

                      PS. I think a about -10% vertical perspective adjustment should have been done to get the verticals parallel but forgot that bit.

                      Edited By Martin Connelly on 02/06/2021 08:50:30

                      #548069
                      Ady1
                      Participant
                        @ady1
                        Posted by Michael Gilligan on 02/06/2021 07:49:04:

                        [ Light travels in straight lines ]

                        Well yes and no

                        Light travels in straight lines by bouncing and dissipating

                        Never forgot about some chap in the far east who invented a camera which could reconstruct deconstructed light

                        so looking down a corridor became like looking down a corridor covered in mirrors, so you could see around corners

                        clever stuff

                        #548072
                        Martin Connelly
                        Participant
                          @martinconnelly55370

                          This is with the vertical perspective tweaked. The problem is as you adjust one thing the previous changes get put out slightly which is why some experiment is required to get the best overall result.

                          jason4.jpg

                          Martin C

                          #548073
                          Michael Gilligan
                          Participant
                            @michaelgilligan61133
                            Posted by Martin Connelly on 02/06/2021 08:46:16:

                            This is tweaked, I haven't spent a lot of time on it so it could be done better […]

                            .

                            Thanks, Martin … we’re on the same track

                            But have you compared the resulting angles with an isometric grid ?

                            MichaelG.

                            .

                            In true ‘Blue Peter’ style … Here is one I prepared earlier:

                            62a8f25e-d6c9-44b5-87c1-3a1938fbc685.jpeg

                            Edited By Michael Gilligan on 02/06/2021 09:21:13

                            #548082
                            Martin Connelly
                            Participant
                              @martinconnelly55370

                              I didn't go that far but once the various edges are parallel then a bit of tweaking of the vertical or horizontal scale and the rotational angle should allow you to match it up. It may need some skew to get the various angles all matched to your grid. It will not be possible to get a perfect match to a symmetrical grid since the original picture was probably not taken from a suitable position. As pointed out light does not go round corners so if the picture was taken from a position to the left or right of the line at 45° to the spindle axis (I think left in this case) you would probably better off using an asymmetrical grid and save some headache.

                              Martin C

                               

                              Edited By Martin Connelly on 02/06/2021 10:40:02

                              Edited By Martin Connelly on 02/06/2021 10:40:30

                              #548087
                              SillyOldDuffer
                              Moderator
                                @sillyoldduffer

                                Another tricky problem from Michael!

                                This shot from Michael's first link suggests why the answer is hard:

                                cameratwist.jpg

                                The type of camera that may have been used to photograph the Jason is adjustable in all three planes, and is positioned and tilted by the operator relative to the target to control perspective and lens distortion. He adjusts images by eye so they look good, rather than them being geometrically correct. Getting back to isometric means first undoing the unknown camera corrections, and then removing perspective and lens distortions; the lens is also unknown.

                                Problem is still difficult even if an ordinary camera was used. The camera sees a perspective image because the object isn't flat. Big cow far away and model cow close up are the same size, making it possible to take photographs like this, which I think are impossible to lay on an isometric grid and recover the dimensions.

                                In the Pisa example, in translating a 3D image of the tower and girl into 2 dimensions the camera has lost the information that tower and girl are on entirely different scales. Although the Pisa example is extreme, the effect also applies to smaller objects like the Jason. It's easier to work with flat photos and stereoscopic pairs than a single photo of a deeply 3D object.

                                Martin's on the right track, and as he says 'some experiment is required to get the best overall result.'

                                The camera never lies? Oh yes it does…

                                Dave

                                #548090
                                Michael Gilligan
                                Participant
                                  @michaelgilligan61133
                                  Posted by Martin Connelly on 02/06/2021 10:29:12:

                                  I didn't go that far but once the various edges are parallel then a bit of tweaking of the vertical or horizontal scale and the rotational angle should allow you to match it up. […]

                                  .

                                  Sorry Martin … That’s where I was, after spending a lot of time on it over the weekend.

                                  The fact that I couldn’t make that final step is why I put it to the forum.

                                  MichaelG.
                                  .

                                  P.S. __ as previously stated, I want to be able to do this sort of conversion, and [unless it forms part of the necessary process] I have no interest in adapting grid to suit the photo.

                                  I happen to have a fondness for isometric projections, and although converting this specific image would be of trivial value, it serves as a suitable exercise.

                                  #548094
                                  Martin Connelly
                                  Participant
                                    @martinconnelly55370

                                    Here is the effect of rotating to even out the angles and skewing to bring the verticals back to vertical. Then stretching the width to get shallower angles. The quality of the picture just decreases with every geometric adjustment.

                                    jason5.jpg

                                    Martin C

                                    #548095
                                    Michael Gilligan
                                    Participant
                                      @michaelgilligan61133

                                      For general info.

                                      This is what you can do [quickly and interactively] with ‘free transform’

                                      This is a screenshot from Procreate; but the functionality is available in Photoshop and other software

                                      458c9db8-3abd-4390-b143-21e2eab2f88b.jpeg

                                      ‘Get your eye in’ and you can see that as a rectangle on a tilted plane.

                                      The result should be directly equivalent to using swing/tilt on a technical camera.

                                      But the little Demon on my shoulder is whispering : Does it also replicate rise/fall ?

                                      MichaelG.

                                      #548096
                                      Michael Gilligan
                                      Participant
                                        @michaelgilligan61133
                                        Posted by SillyOldDuffer on 02/06/2021 10:55:14:

                                        Another tricky problem from Michael!

                                        […]

                                        Problem is still difficult even if an ordinary camera was used. The camera sees a perspective image because the object isn't flat. Big cow far away and model cow close up are the same size, making it possible to take photographs like this, which I think are impossible to lay on an isometric grid and recover the dimensions.

                                        […]

                                        In the Pisa example, in translating a 3D image of the tower and girl into 2 dimensions the camera has lost the information that tower and girl are on entirely different scales. Although the Pisa example is extreme, the effect also applies to smaller objects like the Jason. […]

                                        .

                                        You make some good points, Dave … particularly regarding loss of information

                                        I think, as you have demonstrated, that there could be many ‘alternative realities’ in a captured image

                                        The trick then is to select the one that you want !
                                        … reasonably easy if we happen to know the height of the girl and the height of the tower.

                                        … very easy with the Jason, because I have the machine [and copies of some factory drawings]

                                        MichaelG.

                                        #548139
                                        Michael Gilligan
                                        Participant
                                          @michaelgilligan61133
                                          Posted by Andy Carlson on 02/06/2021 08:17:28:

                                          I've tried something not entirely dissimilar when trying to find dimensions for railway vehicles and buildings that are no longer with us.

                                          […]

                                          .
                                          Thanks for your post, Andy … and apologies for not responding sooner

                                          I have only just seen it blush

                                          Blender seems to have very good facilities for ‘making’ an isometric camera …

                                          Blender frequently crops-up in my searches … when I am trying to find definitive confirmation of my belief that a [physical] technical camera can produce a true isometric image.

                                          MichaelG.

                                          .

                                          Ref. https://www.blender3darchitect.com/architectural-visualization/create-true-isometric-camera-architecture/

                                          Noting the first comment, by rickyx

                                          Edited By Michael Gilligan on 03/06/2021 00:34:24

                                          #548202
                                          Neil Wyatt
                                          Moderator
                                            @neilwyatt

                                            I've used a similar approach to get a 'side on' view of a locomotive photographed obliquely.

                                            There is a deal of distortion, but it helps with working out dimensions.

                                            I've also found that things made in imperial dimensions tend to be sized conveniently, often in obvious 'steps'.

                                            Neil

                                            #548211
                                            Andy Carlson
                                            Participant
                                              @andycarlson18141
                                              Posted by Michael Gilligan on 03/06/2021 00:13:24:

                                              Blender seems to have very good facilities for ‘making’ an isometric camera …

                                              Blender frequently crops-up in my searches … when I am trying to find definitive confirmation of my belief that a [physical] technical camera can produce a true isometric image.

                                              I'd have thought that perspective is a fact of life and (to quote Mr Scott) 'You cannae change the laws of physics'. Tilt and shift lenses can distort things but presumably there is a price somewhere else… which may not be be visible if the object is simple, solid and the right shape… but if you take the extreme case of a wireframe… maybe not possible?

                                              To minimise perspective you'd need a long focal length and put the camera far away. With the right camera position it should then be close to isometric.. but never quite reaching it.

                                              #548220
                                              Michael Gilligan
                                              Participant
                                                @michaelgilligan61133
                                                Posted by Andy Carlson on 03/06/2021 22:05:43:

                                                Posted by Michael Gilligan on 03/06/2021 00:13:24:

                                                […]

                                                I'd have thought that perspective is a fact of life and (to quote Mr Scott) 'You cannae change the laws of physics'. Tilt and shift lenses can distort things but presumably there is a price somewhere else… which may not be be visible if the object is simple, solid and the right shape… but if you take the extreme case of a wireframe… maybe not possible?

                                                To minimise perspective you'd need a long focal length and put the camera far away. With the right camera position it should then be close to isometric.. but never quite reaching it.

                                                .

                                                I’m increasingly unsure, Andy [of my stated belief that a [physical] technical camera can produce a true isometric image]

                                                Perspective really depends on the viewpoint, not upon the focal length of the lens [a blow-up from a 50mm lens will be found to have the same angles as a picture from a 200mm lens], and to achieve true isometric the camera would need to be at infinity.

                                                I will continue to ponder and experiment …

                                                MichaelG.

                                                .

                                                As food-for-thought :

                                                1. Telecentric lenses can do it… but that’s a rather special case.

                                                2. Z-axis ‘macro’ stacking produces isometric images.

                                                 

                                                Ref.1 :https://wp.optics.arizona.edu/optomech/wp-content/uploads/sites/53/2016/10/Tutorial_Hu_Haosheng.pdf

                                                Ref. 2 : https://www.mccrone.com/mm/constructing-a-scanning-light-photomacrography-system/

                                                 

                                                Edited By Michael Gilligan on 03/06/2021 23:55:15

                                                Edited By Michael Gilligan on 04/06/2021 00:03:40

                                              Viewing 22 posts - 1 through 22 (of 22 total)
                                              • Please log in to reply to this topic. Registering is free and easy using the links on the menu at the top of this page.

                                              Advert

                                              Latest Replies

                                              Viewing 25 topics - 1 through 25 (of 25 total)
                                              Viewing 25 topics - 1 through 25 (of 25 total)

                                              View full reply list.

                                              Advert

                                              Newsletter Sign-up