Re: Centroid tracking using DCV

2023-06-22 Thread Ki Rill via Digitalmars-d-announce
On Wednesday, 15 February 2023 at 17:32:33 UTC, Ferhat Kurtulmuş 
wrote:

I heard you are not having fun enough with d today.

Do you know you can do things like this with dlang now? After 
some fiddling with it, my last commits made this possible.


how it looks like: https://www.youtube.com/watch?v=ACC_-TDAtqc
source code: 
https://github.com/aferust/oclcv/tree/main/examples/centroidtracking

DCV: https://github.com/libmir/dcv

Sorry for the potato-quality video. My art director is on 
vacation.


I am cheating a little with OpenCL since things are not fast 
enough at the moment.


Hope you like it.

Enjoy!


I am facing strange ffmpeg errors on Windows. It fails to read a 
frame. Do you have any ideas how to solve it?


Here is the error:
```
ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --prefix=/mingw64 --target-os=mingw32 
--arch=x86_64 --cc=gcc --cxx=g++ --disable-debug 
--disable-stripping --disable-doc --enable-dxva2 --enable-d3d11va 
--enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls 
--enable-gpl --enable-iconv --enable-libaom --enable-libass 
--enable-libbluray --enable-libcaca --enable-libdav1d 
--enable-libfreetype --enable-libfribidi --enable-libgme 
--enable-libgsm --enable-libmodplug --enable-libmp3lame 
--enable-libopencore_amrnb --enable-libopencore_amrwb 
--enable-libopenjpeg --enable-libopus --enable-libplacebo 
--enable-librsvg --enable-librtmp --enable-libssh 
--enable-libsoxr --enable-libspeex --enable-libsrt 
--enable-libtheora --enable-libvidstab --enable-libvorbis 
--enable-libx264 --enable-libx265 --enable-libxvid 
--enable-libvpx --enable-libwebp --enable-libxml2 
--enable-libzimg --enable-openal --enable-pic --enable-postproc 
--enable-runtime-cpudetect --enable-swresample --enable-version3 
--enable-vulkan --enable-zlib --enable-librav1e 
--enable-libsvtav1 --enable-libmfx --enable-amf --enable-nvenc 
--logfile=config.log --enable-shared

  libavutil  58.  2.100 / 58.  2.100
  libavcodec 60.  3.100 / 60.  3.100
  libavformat60.  3.100 / 60.  3.100
  libavdevice60.  1.100 / 60.  1.100
  libavfilter 9.  3.100 /  9.  3.100
  libswscale  7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc57.  1.100 / 57.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video_640x480.mp4':
  Metadata:
major_brand : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.27.100
  Duration: 00:01:00.01, start: 0.00, bitrate: 833 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), 
yuv420p(tv, bt709, progressive), 640x480 [SAR 4:3 DAR 16:9], 822 
kb/s, 30 fps, 30 tbr, 15360 tbn (default)

Metadata:
  handler_name: VideoHandler
  vendor_id   : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 
48000 Hz, stereo, fltp, 2 kb/s (default)

Metadata:
  handler_name: SoundHandler
  vendor_id   : [0][0][0][0]
Using auto hwaccel type dxva2 with new default device.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
configure renderer for GL-31
Output #0, image2pipe, to 'pipe:':
  Metadata:
major_brand : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf60.3.100
  Stream #0:0(und): Video: rawvideo (RGB[24] / 0x18424752), 
rgb24(pc, gbr/bt709/bt709, progressive), 640x480 [SAR 4:3 DAR 
16:9], q=2-31, 147456 kb/s, 20 fps, 20 tbn (default)

Metadata:
  handler_name: VideoHandler
  vendor_id   : [0][0][0][0]
  encoder : Lavc60.3.100 rawvideo
av_interleaved_write_frame(): Broken pipe time=-577014:32:22.77 
bitrate=  -0.0kbits/s speed=N/A

[out#0/image2pipe @ 01acc2c41d80] Error muxing a packet
[out#0/image2pipe @ 01acc2c41d80] Error writing trailer: 
Broken pipe
frame=1 fps=0.5 q=-0.0 Lsize=   0kB time=00:00:00.50 
bitrate=   0.0kbits/s dup=0 drop=3 speed=0.231x
video:900kB audio:0kB subtitle:0kB other streams:0kB global 
headers:0kB muxing overhead: unknown

Error Program exited with code -1073741819
Conversion failed!
```

Also, it does not work on MacOS as well due to `glfw-d` not 
supporting it. I will try to replace the gui part with Raylib... 
Do you have any better solutions?


Re: Beerconf June 2023

2023-06-22 Thread Steven Schveighoffer via Digitalmars-d-announce

On 6/11/23 4:48 PM, Steven Schveighoffer wrote:

# BEERCONF!

Beerconf for June is happening 2 weeks from now, on the 24-25.


A reminder that this is happening in 2 days!

YuQian has asked that I post the abstract for the talk being given. A 
reminder that the talk is on Saturday at 19:00 UTC.


See you there!

-Steve

## Stop inheriting data fields!

A new design pattern DDIFI (Decoupling Data Interface From data 
Implementation) as a clean and general solution to multiple inheritance


### Abstract

Traditionally in class based OOP languages, both the fields and methods 
from the super-classes are inherited by the sub-classes. However this 
may cause some serious problems in multiple inheritance, e.g. most 
notably the diamond problem. In this paper, we propose to stop 
inheriting data fields as a clean and general solution to such problems. 
We first present a design pattern to cleanly achieve multiple 
inheritance in C++, which can handle class fields of the diamond problem 
exactly according to the programmers’ intended application semantics. It 
gives programmers flexibility when dealing with the diamond problem for 
instance variables: each instance variable can be configured either as 
one joined copy or as multiple independent copies in the bottom class.


The key ideas are:

1. decouple data interface from data implementation;
2. in the regular methods implementation use virtual property methods 
instead of direct raw fields; and
3. after each semantic branching add (and override) the new semantic 
assigning property.


Then we show our method is general enough, and also applicable to any 
OOP languages that natively support multiple inheritance (e.g. C++, 
Python, Eiffel, etc.), or single inheritance languages that support 
default interface methods (e.g. Java, C# etc.).


For example, in the diamond inheritance problem of Faculty, and ResearchAssistant>,
we want to achieve the ideal application semantics: each 
ResearchAssistant should only have:

*  one (joined) copy of `_name` field, but
*  two (separated) different address fields:
   - one `_student_addr` ("dorm") as Student to takeRest(), and
   - one `_faculty_addr` ("lab") as Faculty to doBenchwork()

Our new design pattern can achieve this.

Also it works for the current D! although it's a bit hackish. With 
default interface methods it will be better (less convoluted).

(ref: https://github.com/joortcom/DDIFI/blob/main/d/MI.d)

### Speaker Bio

Ph.D Oxford Univ.; previous Google engineer; startup founder.


Re: Centroid tracking using DCV

2023-06-22 Thread Dmitry Olshansky via Digitalmars-d-announce
On Wednesday, 15 February 2023 at 17:32:33 UTC, Ferhat Kurtulmuş 
wrote:

I heard you are not having fun enough with d today.

Do you know you can do things like this with dlang now? After 
some fiddling with it, my last commits made this possible.


Cool stuff! I once contributed Randomized Hough transform to DCV.


how it looks like: https://www.youtube.com/watch?v=ACC_-TDAtqc
source code: 
https://github.com/aferust/oclcv/tree/main/examples/centroidtracking

DCV: https://github.com/libmir/dcv

Sorry for the potato-quality video. My art director is on 
vacation.


I am cheating a little with OpenCL since things are not fast 
enough at the moment.


Hope you like it.

Enjoy!