I am trying to flip an image on a tft from mlx90640 data

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
nitrousbob
 
Posts: 15
Joined: Sun Mar 11, 2018 1:43 pm

I am trying to flip an image on a tft from mlx90640 data

Post by nitrousbob »

my thermal image is mirrored on my display, here is the loop portion that displays the data. Is there a way to edit the "for (uint8_t w=0; w<32; w++)" to display mirrored, I tried putting some different starting values in and subtracting, but I don't understand the code well enough. Or is there another way to manipulate the w value to display from right to left.

with rotation and camera placement I get up and down correctly.

void loop() {
delay(100);
gfx->setCursor(0,0);
if (mlx.getFrame(frame) != 0) {
Serial.println("Failed");
return;
}
gfx->println();
gfx->println();
for (uint8_t h=0; h<24; h++) {
for (uint8_t w=0; w<32; w++) {
float t = frame[h*32 + w];
#ifdef PRINT_TEMPERATURES
gfx->print(t, 1);
gfx->print(", ");
#endif
#ifdef PRINT_ASCIIART
char c = '&';
if (t < 20) c = ' ';
else if (t < 23) c = '.';
else if (t < 25) c = '-';
else if (t < 27) c = '*';
else if (t < 29) c = '+';
else if (t < 31) c = 'x';
else if (t < 33) c = '%';
else if (t < 35) c = '#';
else if (t < 37) c = 'X';
gfx->print(c);
#endif
}
gfx->println();
//gfx->setCursor(0,0);
}
}

thank you

User avatar
sj_remington
 
Posts: 997
Joined: Mon Jul 27, 2020 4:51 pm

Re: I am trying to flip an image on a tft from mlx90640 data

Post by sj_remington »

You can reverse right and left by modifying the fast-changing array index.
This

Code: Select all

for (uint8_t w=0; w<32; w++) {
float t = frame[h*32 + w];
could be changed to

Code: Select all

for (uint8_t w=0; w<32; w++) {
float t = frame[h*32 + (31-w)];

User avatar
nitrousbob
 
Posts: 15
Joined: Sun Mar 11, 2018 1:43 pm

Re: I am trying to flip an image on a tft from mlx90640 data

Post by nitrousbob »

Thank you so much, I wasnt sure where I could manipulate that variable.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”