translation matrix 2d image

Discussion in 'Math' started by ROHIT2929, Jun 28, 2017.

Thread Status:
Not open for further replies.
  1. ROHIT2929

    Thread Starter New Member

    Jun 28, 2017
    24
    0
    hello,
    how rotation of 2d IMAGE work
    as image are store in matrix form
     
  2. MrChips

    Moderator

    Oct 2, 2009
    16,801
    5,156
    Expand the matrix multiplication and compare the results with what one would obtain doing it without matrix arithmetic.
     
  3. ROHIT2929

    Thread Starter New Member

    Jun 28, 2017
    24
    0
    what is tx and ty x' y'
    i am new to it
    please explain
     
  4. MrChips

    Moderator

    Oct 2, 2009
    16,801
    5,156
    tx and ty are your displacement values.
    x' and y' are the coordinates of the object ( x, y) after being displaced (translated) by (tx, ty).
     
  5. ROHIT2929

    Thread Starter New Member

    Jun 28, 2017
    24
    0
    ok, what is x,y then
     
  6. MrChips

    Moderator

    Oct 2, 2009
    16,801
    5,156
    You should know the answer. You asked the question in your first post.

    ( x, y) is your original image or object.
     
  7. ROHIT2929

    Thread Starter New Member

    Jun 28, 2017
    24
    0
    but i have seen image is very big like example
    640x500
    i found in google the formula
     
  8. MrChips

    Moderator

    Oct 2, 2009
    16,801
    5,156
    Start with a smaller image to get an idea of how matrix rotation works.
    Suppose you have a 16 x 16 image.
    There are 256 pixels. Each pixel has a colour or density value.
    Each pixel is given its ( x, y ) coordinates and its colour.
    To describe the image in matrix form, we create a 2-d matrix, example m(16, 16) with a colour value at each element in the matrix.

    Now we can multiply this matrix with a rotational matrix:

    [​IMG]
     
    JohnInTX likes this.
  9. MrAl

    AAC Fanatic!

    Jun 17, 2014
    5,160
    1,117
    Hi,

    That is the matrix i use too but because for most computer 2d graphics we have, well, just two dimensions, that easily reduces to just a 2x2 matrix, and from there it's just two simple equations and that can be applied directly.
    However, there is an interpolation stage that must come next in order to reduce pixelation because for unusual angles we never get result pixels falling on exact existing pixel locations.
     
    JohnInTX likes this.
  10. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    4,713
    5,041
    JohnInTX likes this.
  11. ROHIT2929

    Thread Starter New Member

    Jun 28, 2017
    24
    0
    for solving this cos value which processor will be used?
     
  12. MrChips

    Moderator

    Oct 2, 2009
    16,801
    5,156
    You use the same computer that is running your system.
     
  13. ROHIT2929

    Thread Starter New Member

    Jun 28, 2017
    24
    0
    ok, if we want to do in embedded system....
     
  14. MrAl

    AAC Fanatic!

    Jun 17, 2014
    5,160
    1,117
    Hi,

    You mean in a multi processor system perhaps?
    In that case you would use ALL the available processors if it was a dedicated system, or just maybe 80 percent of the available processors if it still needed user input, but of course since processor count is an integer usually not too high you have to base it partly on the actual number, such as 2, 4, 6, 8, etc. With only two processors for example you only have the choice of 1 or 2, and if you use both it makes it harder on the user if there is one.
    There are two approaches too depending on the kind of jobs to be done. The first is to assign as many processors to one image as possible, and then 'mend' the seams, the second is to assign one processor to each image when there are multiple images to be done when there ae usually more images than processors.

    In any case though as mentioned previously, there needs to be a follow up pixel interpolation in order to create the illusion of a smooth, non pixeled surface where points can be placed anywhere in the 2d space rather than on just pixel point locations (in a 100x200 image here are only 20000 true pixel locations but an image rotation lands pixels in a continuous 2d field where we never get lucky enough to get them all at the original points except for 90 degree and integer multiples of 90 degree rotations). This is more commonly referred to as "anti aliasing".
     
  15. MrChips

    Moderator

    Oct 2, 2009
    16,801
    5,156
    This might be a silly question, but why do you want to rotate an image on an embedded system?
     
    ROHIT2929 likes this.
  16. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    4,713
    5,041
    Exactly, the next step up from pixel primitives are line and circle drawing algorithms with the most basic line routine being the DDA with a simple Slope−Intercept equation.

    http://web.cse.ohio-state.edu/~shen.94/681/Site/DDA_files/DDA.pdf

    A better method is to use something like the Bresenham algorithm.
     
  17. MrAl

    AAC Fanatic!

    Jun 17, 2014
    5,160
    1,117
    Hi,

    Back when i first got into image processing there was very little on the web so i had to write all my own algorithms from scratch. That included various transformations and image enhance algorithms which try to improve the quality of the image. Here is one link i found:
    https://en.wikipedia.org/wiki/Homomorphic_filtering
    and i have one of those guy's books from MIT. So it's basically just a form of DSP where the image is handled as a two dimensional sequence.
    What was a little interesting is this was being used even back then, and the book i have was published back in 1975, before most people had home computers, and i was working on my first personal computer build from a raw 8080 processor around that time.

    I have yet to implement anti aliasing line drawing in my 2d drawing program though, for now it's just regular digital lines (lines, circles, rectangles, triangles, sinusoids, etc.). In my 3d drawing program though i did implement shading, which is really a pain in the neck :)

    Basically i've been doing some form of graphics since around 1980 or so, with the more advanced stuff after 1990. I got a little interested in 3d perspective viewing graphics with lighting and shading, but only did a little with it so far. Too many other things came up in between this and that.
     
  18. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    4,713
    5,041
    I had a similar time-frame with my 2d graphic projects and experiments using a homebrew 8080 powered character and graphics framebuffer with another 8080 or Z80 main processor. I also wrote a few drawing programs for the Atart ST using modula-2 using Bézier curves as the image construction main element. Most of the former software routines are hard-coded into modern graphics engines that are much faster than any possible software solution on generic hardware.

    My old graphics display board.
    https://forum.allaboutcircuits.com/...gnals-from-scratch.130859/page-3#post-1080081
     
  19. MrChips

    Moderator

    Oct 2, 2009
    16,801
    5,156
    Ah! Those were the days. I wrote my own schematic and PCB CAD program written entirely in ASM for a Data General Nova in the early '80s. It had user definable icons, component symbols and IC footprints. That was even before the IBM PC grew a mouse.

    It was fun creating my own DDA using integer math and making it as efficient as possible. Of course, pixels were either ON or OFF and we couldn't implement dithering or anti-aliasing.
     
    nsaspook likes this.
  20. MrAl

    AAC Fanatic!

    Jun 17, 2014
    5,160
    1,117
    Hi,

    Wow that was back when too :)

    I like the phrase "IBM grew a mouse".
    My first 'real' computer didnt even have a mouse. I had to use keyboard based 'menus'.
    I had to do significant graphics on the printer because the display didnt have good graphics yet.
     
Loading...
Thread Status:
Not open for further replies.