Computer Science Canada Pixel Manipulation in Turing |
Author: | GlobeTrotter [ Wed Oct 26, 2005 9:03 pm ] | ||||
Post subject: | Pixel Manipulation in Turing | ||||
Basically, I want to be able to save the RGB values of each pixel into an array. The problem is that the colours get messed up when I try using whatdotcolor. Look at this example, you can use any picture with it. It should theoretically draw out the picture, exactly as it was. If you can maybe point me to some RGB. command that will read the pixels better, I would appreciate it.
I have another question, dealing with the same program. This next procedure is incomplete, and it doesn't work. It should theoretically, go through each pixel, and find the average of x pixels surrounding it, and change the array of pixels to that. Thus, the pixel would be blurred. The procedure checks if the pixel it is averaging is in the middle of the picture such that pixels too far left/right/up/down won't be checked. I'm not sure why, but I'm getting the same array out of bounds error that I just checked to make sure wouldn't happen. Please help.
Just call that procedure inbetween getpixels and drawpixels. |
Author: | Tony [ Thu Oct 27, 2005 7:51 am ] |
Post subject: | |
the whatdotcolour() function is flawed as it will return the pallet colour that matches the dot the closest. Then RGB.GetColour returns RGB of that 8bit estimation. I'm not sure if this will work, but if you precreate your pallet by looping though RGB, you could expend it to 31bit (Turing's integers are signed) Otherwise you could read RGB values directly from the file. You might been to figure out the format first. BMP should be the easiest as there's no compression. |
Author: | GlobeTrotter [ Thu Oct 27, 2005 4:57 pm ] |
Post subject: | |
Okay, thanks... but what about my second question? Why am I getting out of bounds errors? |
Author: | Tony [ Fri Oct 28, 2005 9:02 am ] |
Post subject: | |
well you have PixelArray (x, y) := tempAvg while the loop goes up to x = maxx + 1 what's the boundry of PixelArray? |
Author: | GlobeTrotter [ Fri Oct 28, 2005 3:41 pm ] | ||
Post subject: | |||
|
Author: | GlobeTrotter [ Mon Oct 31, 2005 5:53 pm ] | ||
Post subject: | |||
Okay, I tried reading straight from a .BMP file, but I'm having some trouble. The tutorial I'm reading is done in C, I think, and I don't know C. I've managed to read the header information, but am having trouble reading the pixel information. Please help. The site I'm working from is here: http://www.xbdev.net/image_formats/bmp/index.php?leftbarHIDE=1 Basically, I'm trying to copy that code into Turing, and I'm finding it difficult, especially to part about to pointer to an int, and some of the bit shifting.
|
Author: | Tony [ Sat Nov 05, 2005 8:00 pm ] |
Post subject: | |
![]() |