-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ndslice + color = (mir / std.experimental).image #343
Comments
|
ping @timotheecour. You may be interesting in this issue |
I took a quick look at the color library, and recognized troubles you state here. There's also one big issue I can see for dcv usage: since there's a lot of meta info in color structures like
I've thought about this before. Processing multi-channel images as Slice!(3, ubyte*), often can be done a channel at the time. So having a structure like Could you note what would be the key differences between Also, imho |
|
We do not need to copy data for rgb8. The same raw data is valid. I will modify packed slices so we can use them for images without additional types |
Could you give me a simple example? Sorry, I haven't figured out how to do it - docs are really poor, and there are almost no examples in the library.. :(
That's awesome - that was my thought exactly! :) |
|
RGB image is just sequence of RGB triplets. RGB8 is just single triplet |
|
I thought you were referring to this structure. My point was, if we have |
|
We can. the raw data is the same. |
|
Will check when be at home |
|
RGB8 has sizeof equal to 3 and alignof equal to 1. It is equivalent to struct SimpleRGB8 { ubyte r,g,b; } |
|
@ljubobratovicrelja The conversion code should look like: // sl is type of Slice!(3, ubyte*)
auto image = Slice!(2, RGB8*)(sl.shape[0 .. 2], sl.structure.strides[0 .. 2], sl.ptr); |
Aaah, ok, I got it - all the time I've been trying the same and been getting gibberish. Strides are wrong, we should divide stride values by 3: long [2]strides = raw.structure.strides[0 .. 2];
strides[] /= 3;
auto image = Slice!(2, RGB8*)(sl.shape[0 .. 2], strides, sl.ptr);Now it works. Great, thanks! :) |
Ah, thanks! |
|
Your opening comment describes splitting into planes as a goal. I would suggest that goal is strictly for bonus points. Most multimedia software will not find that acceptable (ie, textures). I think image processing of normal formats should come first, and be prioritised. |
|
I'm having trouble following what you're actually trying to achieve throughout this thread... you're trying to reformat the image into planes? R8[] r; G8[] g; B8[] b;
XYZ!float[] xyz;
foreach(i; 0..N)
xyz[i] = cast(XYZ!float)r[i] + cast(XYZ!float)g[i] + cast(XYZ!float)b[i];That should even be equally efficient to an RGB8 conversion since it's just a 3x3 matrix multiply, and each plane will have 2 implicit zero colums, so the total work will be identical either way. Most such operations should work by doing the operation 3 times and summing the result, and the implied zeroes should eliminate the redundant work, breaking-even. |
|
Also conversions from |
|
no plan to add the package into the main Mir repo |
|
I could add this to Mir... Infact, Mir's better-c mission is looking better to me every day. |
Added you to the Mir organization https://github.com/libmir/mir-image The main repo would be split into others repositories after a while. |
I'm not sure what you're talking about? |
Sparse tensors will be reworked and moved to |
Slices like
Slice!(2, RGB8*)are good but they are not always optimal for image processing and computer vision algorithms becauseFuture
imagemodule should contain:RGBSlice!(N, ubyte*), which contains 3Slice!(N, ubyte*), one per channel.See also: color package, forum thread
The text was updated successfully, but these errors were encountered: