start histogram, fix image orientation
This commit is contained in:
27
main.cpp
27
main.cpp
@ -37,6 +37,8 @@
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include "lib/histogram.h"
|
||||
|
||||
struct Args : public argparse::Args {
|
||||
std::string &fpath = arg("path to the image");
|
||||
};
|
||||
@ -228,8 +230,6 @@ Texture LoadTexture(const char * path)
|
||||
|
||||
auto exif = printExifData(path);
|
||||
|
||||
|
||||
|
||||
GLenum dataFormat = GL_RGBA;
|
||||
GLuint textureHandle;
|
||||
glGenTextures(1, &textureHandle);
|
||||
@ -244,6 +244,23 @@ Texture LoadTexture(const char * path)
|
||||
t.channels = channelCount;
|
||||
t.exif = exif;
|
||||
|
||||
if (t.exif.ImageOrientation == "3") {
|
||||
RotateImage(t);
|
||||
ReloadTexture(t, t.size.x, t.size.y);
|
||||
t = ReloadTexture(t, t.size.y, t.size.x);
|
||||
RotateImage(t);
|
||||
t = ReloadTexture(t, t.size.y, t.size.x);
|
||||
} else if (t.exif.ImageOrientation == "6") {
|
||||
RotateImage(t);
|
||||
t = ReloadTexture(t, t.size.y, t.size.x);
|
||||
} else if (t.exif.ImageOrientation == "8") {
|
||||
RotateImage(t);
|
||||
t = ReloadTexture(t, t.size.y, t.size.x);
|
||||
RotateImage(t);
|
||||
t = ReloadTexture(t, t.size.y, t.size.x);
|
||||
RotateImage(t);
|
||||
t = ReloadTexture(t, t.size.y, t.size.x);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
@ -596,6 +613,12 @@ int main(int argc, char* argv[]) {
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
ImGui::Text("%sx%s", t.exif.ImageDimensionX.c_str(), t.exif.ImageDimensiony.c_str());
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
ImGui::Text("Orientation");
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
ImGui::Text("%s", t.exif.ImageOrientation.c_str());
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user