well, working now. I think.

This commit is contained in:
yggdrasil75
2025-11-24 17:24:34 -05:00
parent 89596ee2be
commit 72c318a320
3 changed files with 9 additions and 8 deletions

View File

@@ -1120,23 +1120,23 @@ public:
else if (ctemp < minTemp) minTemp = ctemp; else if (ctemp < minTemp) minTemp = ctemp;
} }
} }
std::cout << "max temp: " << maxTemp << " min temp: " << minTemp << std::endl;
// std::cout << "getTempAsFrame() middle" << std::endl; // std::cout << "getTempAsFrame() middle" << std::endl;
std::vector<uint8_t> rgbaBuffer; std::vector<uint8_t> rgbaBuffer(width*height*4, 0);
rgbaBuffer.reserve(tempBuffer.size() * 4);
for (const auto& [v2, temp] : tempBuffer) { for (const auto& [v2, temp] : tempBuffer) {
size_t index = (v2.y + v2.y) * 4; size_t index = (v2.y * width + v2.y) * 4;
double atemp = static_cast<unsigned char>((((temp-minTemp) * 100) / (maxTemp-minTemp)) * 255); uint8_t atemp = static_cast<unsigned char>((((temp-minTemp) * 100) / (maxTemp-minTemp)) * 255);
rgbaBuffer[index] = atemp; rgbaBuffer[index] = atemp;
rgbaBuffer[index+1] = atemp; rgbaBuffer[index+1] = atemp;
rgbaBuffer[index+2] = atemp; rgbaBuffer[index+2] = atemp;
rgbaBuffer[index+3] = 1.0; rgbaBuffer[index+3] = 255;
} }
std::cout << "rgba buffer is " << rgbaBuffer.size() << std::endl;
frame result = frame(res.x,res.y, frame::colormap::RGBA); frame result = frame(res.x,res.y, frame::colormap::RGBA);
result.setData(rgbaBuffer); result.setData(rgbaBuffer);
return result;
updatingView = false; updatingView = false;
return result;
} }
}; };

View File

@@ -150,6 +150,7 @@ public:
} else if (frame.colorFormat == frame::colormap::RGBA) { } else if (frame.colorFormat == frame::colormap::RGBA) {
std::cout << "found incorrect colormap. converting from RGBA" << std::endl; std::cout << "found incorrect colormap. converting from RGBA" << std::endl;
std::vector<uint8_t> fdata = convertRGBAtoRGB(frame.getData()); std::vector<uint8_t> fdata = convertRGBAtoRGB(frame.getData());
std::cout << "source data: " << frame.getData().size() << " out data: " << fdata.size() << std::endl;
return saveBMP(filename, fdata, frame.getWidth(), frame.getHeight()); return saveBMP(filename, fdata, frame.getWidth(), frame.getHeight());
} }
else { else {

View File

@@ -76,7 +76,7 @@ public:
_compressedData.shrink_to_fit(); _compressedData.shrink_to_fit();
overheadmap.clear(); overheadmap.clear();
sourceSize = data.size(); sourceSize = data.size();
std::cout << "wrote " << data.size() << " as frame" << std::endl;
} }
const std::vector<uint8_t>& getData() const { const std::vector<uint8_t>& getData() const {