translation matrix 2d image

Status
Not open for further replies.

MrChips

Joined Oct 2, 2009
30,711
Expand the matrix multiplication and compare the results with what one would obtain doing it without matrix arithmetic.
 

MrChips

Joined Oct 2, 2009
30,711
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:

 

MrAl

Joined Jun 17, 2014
11,389
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.
 

MrAl

Joined Jun 17, 2014
11,389
for solving this cos value which processor will be used?
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".
 

nsaspook

Joined Aug 27, 2009
13,082
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".
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.
 

MrAl

Joined Jun 17, 2014
11,389
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.
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.
 

nsaspook

Joined Aug 27, 2009
13,082
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.
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
 

MrChips

Joined Oct 2, 2009
30,711
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.
 

MrAl

Joined Jun 17, 2014
11,389
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.
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.
 
Status
Not open for further replies.
Top