fix some bugs
This commit is contained in:
@@ -119,7 +119,7 @@ int sc_main(int argc, char* argv[]) {
|
||||
ifstream in_image;
|
||||
ofstream out_image;
|
||||
in_image.open("./transform/test.bin", ios::in | ios::binary);
|
||||
out_image.open("./out.bin", ios::out | ios::binary);
|
||||
out_image.open("./transform/out.bin", ios::out | ios::binary);
|
||||
if (!in_image.is_open()) {
|
||||
cout << "Open image fail" << endl;
|
||||
exit(0);
|
||||
@@ -128,13 +128,11 @@ int sc_main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
// Read image
|
||||
// uint8_t buf[IN_SIZE * 2] = {0};
|
||||
auto buf = make_unique<uint8_t[]>(2 * IN_SIZE);
|
||||
// vector<vector<uint8_t>> buf(IN_HEIGHT, vector<uint8_t>(IN_WIDTH, 0));
|
||||
in_image.read((char*)buf.get(), IN_SIZE * 2);
|
||||
in_image.close();
|
||||
// Reshape data
|
||||
// uint16_t image[IN_HEIGHT][IN_WIDTH] = {0};
|
||||
auto image = make_unique<uint16_t[]>(IN_SIZE);
|
||||
uint32_t i = 0;
|
||||
for (int y = 0; y < IN_HEIGHT; y++) {
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import imageio
|
||||
import numpy as np
|
||||
|
||||
im_width = 512
|
||||
im_height = 256
|
||||
im_width = 640
|
||||
im_height = 480
|
||||
|
||||
if __name__ == '__main__':
|
||||
raw = np.fromfile('./out.bin', dtype=np.int16)
|
||||
raw = np.fromfile('./out.bin', dtype=np.int32)
|
||||
image = raw.reshape((im_height, im_width))
|
||||
imageio.imsave("./out.png", image)
|
||||
|
Reference in New Issue
Block a user