Current Server Time: 10:26 (Central Europe)

#apertus IRC Channel Logs

2018/02/17

Timezone: UTC


23:33
TofuLynx
in a 12 bits raw image file, for each 12 bits in the file, I have to add 4 zeroes next it? Aka bit padding?
00:45
TofuLynx
off to bed. bye bye!
00:45
TofuLynx
left the channel
00:52
TofuLynx
joined the channel
00:57
TofuLynx
left the channel
00:57
TofuLynx
joined the channel
03:13
davidak
left the channel
03:13
davidak
joined the channel
03:22
davidak
left the channel
05:33
Bertl_zZ
changed nick to: Bertl
05:33
Bertl
morning folks!
05:34
Bertl
TofuLynx: no padding in raw12, it is packed ... there is padding in raw16 though
06:29
BAndiT1983|away
changed nick to: BAndiT1983
06:55
BAndiT1983
changed nick to: BAndiT1983|away
08:29
niemand
joined the channel
08:29
niemand
left the channel
08:29
niemand
joined the channel
09:06
BAndiT1983|away
changed nick to: BAndiT1983
10:03
rton
joined the channel
10:43
TofuLynx
Hello!
10:46
TofuLynx
I'am not sure if it's correct, but if I took one of the four colours of a raw file, and made a image with half the width and height with it as requested, shouldn't it be a continuous picture? without the normal separations between same pixel colors in the raw image?
10:49
Bertl
yup
10:54
Kjetil_
joined the channel
10:58
fredy_
joined the channel
11:00
fredy
left the channel
11:00
Kjetil
left the channel
11:00
fredy_
changed nick to: fredy
11:00
fredy
changed nick to: Guest35400
12:23
TofuLynx
left the channel
12:36
TofuLynx
joined the channel
12:39
BAndiT1983
changed nick to: BAndiT1983|away
12:44
RexOrCine
left the channel
12:46
RexOrCine
joined the channel
13:01
se6astian|away
changed nick to: se6astian
13:18
BAndiT1983|away
changed nick to: BAndiT1983
13:18
arpu
left the channel
13:22
BAndiT1983
changed nick to: BAndiT1983|away
13:22
BAndiT1983|away
changed nick to: BAndiT1983
15:13
futarisIRCcloud
left the channel
15:28
BAndiT1983
changed nick to: BAndiT1983|away
15:42
se6astian
changed nick to: se6astian|away
15:45
Kjetil_
changed nick to: Kjetil
15:46
TofuLynx
left the channel
15:46
TofuLynx
joined the channel
15:48
TofuLynx
how do I know if I correctly identified each one of the color channels of the raw file?
15:49
Bertl
when combining them gives a proper image?
15:49
Kjetil
hihi
15:49
TofuLynx
well I havent combined them yet
15:50
Kjetil
do you know how the image is supposed to look?
15:50
TofuLynx
yeah
15:50
davidak
joined the channel
15:51
TofuLynx
the grayscale pictures reveal a man
15:51
TofuLynx
with some boxes at the background
15:51
Kjetil
If you had the original you could decompose the color layers with gimp.. oh well
15:52
TofuLynx
yeah hmm
15:52
TofuLynx
i will assume i correctly identified,
15:52
TofuLynx
if i get strange colors in the combined image...
16:13
se6astian|away
changed nick to: se6astian
16:27
TofuLynx
I noticed I have two small 4 pixel wide bars on the left and right sides of the image, is it normal?
16:27
TofuLynx
Not a bar with a fixed cor
16:29
Bertl
no, that's not normal
16:30
TofuLynx
hmm strange
16:32
aombk
left the channel
16:34
BAndiT1983|away
changed nick to: BAndiT1983
17:21
TofuLynx
in the 4 layers of colors, two of them seem strange, like with strong color changes and details
17:21
TofuLynx
is that normal?
17:22
TofuLynx
or should the 4 layers be similar?
17:22
Bertl
they are similar but note that green is very 'visible' compare to red or even blue
17:23
TofuLynx
well for some reason two of the layers seem very exaggerated
17:23
TofuLynx
is it possible to show the image I got?
17:24
Bertl
use an image pastebin
17:25
TofuLynx
Here's the strange one: https://pasteboard.co/H85QFv7.png
17:25
TofuLynx
and the apparent normal one: https://pasteboard.co/H85QShD.png
17:26
Bertl
that looks like LSBs and MSBs
17:27
Bertl
i.e. in the 'strange' one you are cycling through the available gray values more than once
17:28
Bertl
means there is most likely something wrong with the unpacking
17:33
TofuLynx
hmm
17:33
BAndiT1983
TofuLynx, how does your method, for conversion of 12 bit to 16 bit, looks like?
17:35
TofuLynx
I didn't do the conversion, I read 12 bits each time and the put the value shifted right 4 times (so it is 8 bits) and insert it in the grayscale vector of the respective color layer
17:36
Bertl
BAndiT1983: stop confusing people with a 16 bit conversion :)
17:36
BAndiT1983
it's important to do that step
17:36
TofuLynx
why?
17:37
BAndiT1983
you can also shift the bits to get 8 bits, but it's more comfortable first to get 12 bit into 16 bit array
17:37
TofuLynx
you mean like
17:37
BAndiT1983
lodepng supports 16bit format, so there is no issue
17:37
TofuLynx
a uint16 array?
17:37
BAndiT1983
yes
17:37
BAndiT1983
let me check my sample code
17:38
TofuLynx
but the challenge requests for a 8bit image
17:38
TofuLynx
does lodepng convert from 16bit to 8?
17:38
BAndiT1983
8bit conversion is just adding a shift to the bits
17:38
BAndiT1983
don't remember if it does or not, it was some time ago, when i've created sample code to verify the challenge
17:38
Bertl
it is perfectly fine to read 12bit and convert it to 8bit directly, just make sure that you are actually reading 12bit
17:39
TofuLynx
well, I think I am xD
17:40
TofuLynx
but the "strange" image made and the 4 pixel wide bars on the left and right
17:40
TofuLynx
make me think there's something wrong with the unpackaging as you said
17:41
TofuLynx
and I am suspecting it is related to the LSBs and MSB, with the endian system
17:42
BAndiT1983
hint: take 3 bytes and split them in half to get 2x12bit pixels
17:42
TofuLynx
hmm
17:43
TofuLynx
that surely does help a lot
17:43
BAndiT1983
you have to merge them first in uint32_t, then do shifting to get 12 bits
17:43
Bertl
also not necessary
17:43
BAndiT1983
?
17:44
Kjetil
How is the 12-bits packet into bytes? Big endian?
17:44
BAndiT1983
not in that file
17:44
BAndiT1983
have no byte swap, according to the sample code
17:46
BAndiT1983
we also don't have a header, like TIFF or DNG (which is TIFF extension), to check if it is little- or big-endian
17:46
BAndiT1983
this data stream can be processed as is
17:47
BAndiT1983
Bertl, why is it not necessary?
17:47
TofuLynx
hmmm I think i am reading the file the wrong way
17:48
BAndiT1983
how?
17:50
TofuLynx
I think I am reading from the end to the start
17:50
TofuLynx
which shouldn't happen
17:51
TofuLynx
I will check it
17:51
BAndiT1983
? must be a new functionality in C++ :D
17:52
TofuLynx
xD
17:54
TofuLynx
the first 3 bytes I read from the file will be RED and then green? right?
17:54
BAndiT1983
nope
17:54
BAndiT1983
bayer image is grayscale one
17:55
TofuLynx
huh?
17:55
BAndiT1983
but the intensity is based on the filter of the microlens on the sensor in front of the cell it was read from
17:55
TofuLynx
yeah
17:56
BAndiT1983
so you have to know the pattern, e.g. RGGB
17:56
TofuLynx
in this case is RGGB, as said on the site, right?
17:56
TofuLynx
and the first 3 bytes I read will be the intesity of the red sensor and then the intensity of green sensor?
17:57
BAndiT1983
i think so, haven't checked description lately, was adjusted by several people already
17:57
BAndiT1983
first 3 bytes consist of 2 pixels, e.g. R and G
17:58
BAndiT1983
so the first row of the image has R and G pixels, each channel has an empty pixel in between
17:58
TofuLynx
and the next 3 bytes will be R and G again, right?
17:58
BAndiT1983
and second one G and B, same here, empty pixel in every channel between filled ones
17:58
BAndiT1983
yes
17:58
TofuLynx
ok :)
18:02
BAndiT1983
http://www.peter-slansky.de/bereiche/astronomie/aufnahmetechniken/bilder/foveon_x3_01.gif
18:03
BAndiT1983
images in first row show what i mean
18:03
TofuLynx
yeah
18:03
TofuLynx
thanks!
18:03
BAndiT1983
second row shows other type of sensor, where the layers are fully exposed, but they also have other problems, like color shifting, because of manufacturing differences
18:05
TofuLynx
I see
18:05
TofuLynx
yesterday I read that some brands started using CMY bayer sensors
18:05
TofuLynx
recently
18:05
TofuLynx
that despite being harder to manufacture
18:06
BAndiT1983
there are different versions of bayer sensors, some have bigger and smaller cells together
18:06
TofuLynx
have better results
18:06
TofuLynx
yeah
18:17
BAndiT1983
off for now
18:17
BAndiT1983
changed nick to: BAndiT1983|away
18:26
TofuLynx
I changed the approach
18:26
TofuLynx
following the 3 byte suggestion of bandit
18:26
TofuLynx
and its giving me the exact same result
18:27
TofuLynx
two "strange" layers and two "normal" layers
19:17
davidak
left the channel
19:17
davidak
joined the channel
19:29
davidak
left the channel
19:29
davidak
joined the channel
19:30
TofuLynx
https://pasteboard.co/H85QFv7.png this is the "strange" image I get in two of the four layers. If anybody knows anything that may cause it, it would be great to explain me. :)
19:39
Bertl
as I said before, you are obviously using the lower bits of a 12bit value
19:51
TofuLynx
and I should use the higher bits?
19:51
Bertl
if you have 12bit data, you want to drop the lower 4bit when converting to 8bit, no?
19:52
TofuLynx
why doesnt it happen with the other two layers?
19:52
TofuLynx
yeah and I do it, supposedly
19:54
Bertl
well, don't know your code, but either you are unpacking the wrong bits, or you are dropping the wrong bits
20:00
TofuLynx
lets take a case example, if I read those 3 butes: FF854008, i should read 854 for R and read 008 for G, right?
20:00
TofuLynx
oops
20:00
TofuLynx
85 for REd and 0 for G
20:00
TofuLynx
right?
20:01
Bertl
FF8 540 08.
20:01
Bertl
but you listed 4byte :)
20:02
TofuLynx
sorry xD
20:02
TofuLynx
85 40 08
20:03
Bertl
with those, assuming that the bit/byte order is correct
20:03
Bertl
854 and 008 are the 12bit values and thus 85 and 00 the (rounded down) 8 bit values
20:03
TofuLynx
yeah
20:03
TofuLynx
hmm
20:16
niemand
left the channel
20:16
TofuLynx
I outputted on the console the process of getting the two values from 3 bytes and the behaviour is correct
20:17
TofuLynx
so it can be the bit order (?)
20:18
Bertl
most likely
20:18
TofuLynx
isnt the read from left to right?
20:18
TofuLynx
I mean, the common fread()
20:19
Bertl
hint: on the wiki is an ImageMagick command to debayer a raw12 image
20:21
TofuLynx
left the channel
20:21
TofuLynx
joined the channel
20:22
TofuLynx
I'm not sure if that is related to my problem
20:22
TofuLynx
will have to check further
20:46
BAndiT1983|away
changed nick to: BAndiT1983
20:47
BAndiT1983
TofuLynx, you have to shift right by 4 to get 8 bit from 12
20:48
BAndiT1983
as 854 is out of range of 8 bit
20:48
BAndiT1983
854 hex is meant
20:51
futarisIRCcloud
joined the channel
20:54
TofuLynx
yes that's what I do
21:05
se6astian
changed nick to: se6astian|away
21:14
aj_
joined the channel
21:16
TofuLynx
left the channel
21:17
TofuLynx
joined the channel
21:19
aj_
"Current Development Status (6th February 2017)" is the 17 only a typo or has the main website not benn updatet?
21:25
TofuLynx
good question
21:30
BAndiT1983
where is this?
21:30
TofuLynx
https://www.apertus.org/axiom-beta-status
21:31
BAndiT1983
most probably typo, as a couple of people were recently updating stuff in that area
21:31
BAndiT1983
will ask se6astian about it
21:31
TofuLynx
ok :)
21:32
TofuLynx
I am still stuck on the Strange images
21:32
TofuLynx
is it possible to send you a pastebin of the code so you can check it?
21:32
BAndiT1983
can you post your code somewhere?
21:32
Kjetil
heh
21:32
BAndiT1983
same idea, 2 people
21:32
TofuLynx
ahahah
21:32
TofuLynx
Wait a second
21:36
TofuLynx
https://pastebin.com/rMkEwPq3
21:36
TofuLynx
Here is it
21:37
TofuLynx
not sure if it helps
21:37
BAndiT1983
hm, i see a lot of issues there
21:37
TofuLynx
but the strange image layers are associated to ValueB
21:37
TofuLynx
ValueA*
21:37
BAndiT1983
first i would suggest to read everything into an uint8_t or unsigned char array
21:38
BAndiT1983
there us no need to read it by x and y loops
21:38
TofuLynx
why not vector<unsigned char> as lodepng encode needs it?
21:38
BAndiT1983
afterwards you can walk through the array with index += 3
21:38
BAndiT1983
vector has some overhead, so i prefer plain data for such stuff
21:39
TofuLynx
Oh I understand
21:39
BAndiT1983
imagine all the conversions if one tries to optimize code through SIMD/SEE and so on
21:39
TofuLynx
But do you think there is something wrong?
21:39
Kjetil
(I like stdint.h types)
21:39
BAndiT1983
of course, it could happen that some method add alignment while reading, so read the whole file into memory
21:40
BAndiT1983
then just use uint8_t for the array, it's unsigned char
21:41
TofuLynx
so you recommend loading the file to memory, then read 3 bytes to load the bits to unsigned char arrays, right?
21:41
Kjetil
since you are reading from a file into the memory of a int, you will propably have some endian issues
21:42
BAndiT1983
nope, first you read whole file to uint8_t array, then you walk through it and processing 3 bytes into another uint8_t array
21:43
TofuLynx
I will check it bandit
21:43
BAndiT1983
remember -> 3 bytes -> shifting/splitting -> 2 x 8bit values
21:44
BAndiT1983
or to be precise 12bit first
21:44
TofuLynx
yeah
21:44
TofuLynx
Kjetil
21:44
BAndiT1983
for (long long index = 0; index < length; index += 3)
21:45
BAndiT1983
that's the header of the loop in my sample code
21:45
TofuLynx
(I like stdint.h types)
21:45
TofuLynx
Are these valuable for this case?
21:45
BAndiT1983
?
21:45
TofuLynx
and length is 3072*4096?
21:46
TofuLynx
I am referring to kjetil, sorry xD
21:46
BAndiT1983
length is the filesize length
21:46
TofuLynx
but shouldn't it avoid the possible appended image sensor registers dump?
21:46
Kjetil
I just get this fuzzy feeling with standard C-types. As their sizes are quite CPU dependent
21:47
BAndiT1983
no sensor registers there, just plain data stream from photo cells
21:47
TofuLynx
ah ok
21:47
TofuLynx
so I don't need to worry about it?
21:48
BAndiT1983
no, not at all
21:54
Kjetil
#include "lodepng.cpp" - please use the header file instead ?
21:54
TofuLynx
oops
21:54
TofuLynx
fixed
21:54
TofuLynx
also
21:55
TofuLynx
What kind of approach do you use to get the file size in bytes? fstream?
21:58
Kjetil
I get you can use fseek,SEEKEND and ftell iirc
21:58
Kjetil
guess*
21:58
TofuLynx
yeah but from what I read it could give errors in some cases
21:59
TofuLynx
But I guess in this case it's not particularly important
21:59
BAndiT1983
try it first, before assuming from docs
21:59
BAndiT1983
using ifstream nowadays
21:59
BAndiT1983
in.seekg(0, std::ios::end);
21:59
BAndiT1983
length = in.tellg();
21:59
BAndiT1983
in.seekg(0, std::ios::beg);
22:01
aj_
left the channel
22:02
TofuLynx
Thanks!
22:04
BAndiT1983
off for today
22:05
BAndiT1983
changed nick to: BAndiT1983|away
22:13
davidak
left the channel
22:13
davidak
joined the channel
22:17
davidak
left the channel
22:17
davidak
joined the channel
22:29
Bertl
off to bed ... have a good one!
22:29
Bertl
changed nick to: Bertl_zZ
22:29
TofuLynx
Good Night!
22:33
aombk
joined the channel
22:43
TofuLynx
By using this for loop " for (long long index = 0; index < length; index += 3) ", how do you know when it's a odd or even row, so that you can identify if it is a RG row or GB row
22:43
TofuLynx
?
22:45
davidak
left the channel
22:45
davidak
joined the channel
22:47
davidak
left the channel
22:47
davidak
joined the channel
22:53
rton
left the channel