www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Reviving DCV help needed [Computer Vision library for D]

reply Ki Rill <rill.ki yahoo.com> writes:
I was looking for a computer vision library for D. I know 
[opencvd](https://code.dlang.org/packages/opencvd) package 
exists. It uses OpenCV C interface.

I also stumbled upon DCV. It is a part of mir meta package. It 
seems it is written from scratch. I really liked the code 
examples. It stays true to the D spirit, so to speak. So I 
decided to revive it on my free time.

I'd like to get some help if possible and/or any advise that will 
help me save time and prevent me from going astray on my quest.

Who is the maintainer of DCV?

I was fixing all the 'depreciated' features and errors, and came 
across this issue:
```D
.dub/packages/mir-algorithm-3.10.91/mir-algorithm/source/mir/ndslic
/internal.d(192,5): Error: static assert:  "dimension = 4LU at position 2LU
should be less than N = 4LU
- - -
Error in function
mir.ndslice.dynamic.transposed!(0LU, 1LU, 
4LU).transposed!(SliceIterator!(ZipIterator!(float*, float*), 
1LU, mir_slice_kind.contiguous), 4LU, 
mir_slice_kind.universal).transposed
- - -
Function prototype
mir.ndslice.dynamic.transposed!(0LU, 1LU, 
4LU).transposed!(SliceIterator!(ZipIterator!(float*, float*), 
1LU, mir_slice_kind.contiguous), 4LU, 
mir_slice_kind.universal).transposed(Slice!(SliceIterator!(ZipIterator!(float*,
float*), 1LU, mir_slice_kind.contiguous), 4LU, mir_slice_kind.universal) _slice)
_____"
source/dcv/multiview/stereo/matching.d(240,41):        
instantiated from here: 
`transposed!(SliceIterator!(ZipIterator!(float*, float*), 1LU, 
mir_slice_kind.contiguous), 4LU, mir_slice_kind.universal)`
source/dcv/multiview/stereo/matching.d(188,12):        
instantiated from here: `windowCost!((l, r) => 
reduce!sad(CostType(0), l, r))`
/Library/D/dmd/bin/dmd failed with exit code 1.
```

`transposed` comes from `mir-algorithm`.

I understand the constraints of `transposed`. It checks 
`DimensionCTError`. But I'm having difficulties understanding 
what DCV code does. It would be great if someone could help me 
with this.

```
for(size_t d = 0; d < props.disparityRange; d++) {
     costVol[0 .. $, 0 .. d, d] = CostType.max;
     import mir.ndslice.dynamic;
     costVol[0 .. $, d .. $, d] = zip!true(lpad[0 .. $, d .. $], 
rpad[0 .. $, 0 .. $ - d])
     .pack!1
     .windows(windowSize, windowSize)
     .unpack
     .universal
     .transposed!(0, 1, 4) // IT SEEMS ERROR OCCURS AT THIS LINE 
(?)
     .pack!2
     .map!(x => fun(x.unzip!'a', x.unzip!'b'))
     .pack!1
     .map!sum
     .unpack;
}
```

Any help is greatly appreciated.
Oct 28 2021
next sibling parent Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= <aferust gmail.com> writes:
On Friday, 29 October 2021 at 03:47:37 UTC, Ki Rill wrote:
 I was looking for a computer vision library for D. I know 
 [opencvd](https://code.dlang.org/packages/opencvd) package 
 exists. It uses OpenCV C interface.

 [...]
Before creating the binding (opencvd) I asked the same question by opening an issue for DCV. One of the maintainers said it is dead. It would be nice if some people will revive it. I don't have much time nowadays. But i would contribute more to this in the future.
Oct 29 2021
prev sibling next sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Friday, 29 October 2021 at 03:47:37 UTC, Ki Rill wrote:
 I was looking for a computer vision library for D. I know 
 [opencvd](https://code.dlang.org/packages/opencvd) package 
 exists. It uses OpenCV C interface.

 [...]
You could maybe try contacting Henry Gouk for more information https://henrygouk.com/
Oct 29 2021
prev sibling parent Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= <aferust gmail.com> writes:
On Friday, 29 October 2021 at 03:47:37 UTC, Ki Rill wrote:
 I was looking for a computer vision library for D. I know 
 [opencvd](https://code.dlang.org/packages/opencvd) package 
 exists. It uses OpenCV C interface.
 ```
 for(size_t d = 0; d < props.disparityRange; d++) {
     costVol[0 .. $, 0 .. d, d] = CostType.max;
     import mir.ndslice.dynamic;
     costVol[0 .. $, d .. $, d] = zip!true(lpad[0 .. $, d .. $], 
 rpad[0 .. $, 0 .. $ - d])
     .pack!1
     .windows(windowSize, windowSize)
     .unpack
     .universal
     .transposed!(0, 1, 4) // IT SEEMS ERROR OCCURS AT THIS LINE 
 (?)
     .pack!2
     .map!(x => fun(x.unzip!'a', x.unzip!'b'))
     .pack!1
     .map!sum
     .unpack;
 }
 ```

 Any help is greatly appreciated.
I also stuck there :) Here is my dcv revision. I believe everything works now, except the stereo module. Maybe, we share our experiences to revive dcv. I don't know; perhaps, you have already solved the problems? https://github.com/aferust/dcvrev
Dec 01 2021