Recent

Author Topic: Rectangular isolation  (Read 9135 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Rectangular isolation
« Reply #15 on: February 05, 2016, 05:32:54 pm »
Also with your example I can do transforms Hough.
but how to extract the coordinates of the rectangles obtained?
Because in the end I need to get those
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Rectangular isolation
« Reply #16 on: February 05, 2016, 05:52:51 pm »
Where do I download opencv for lazarus? Now he's doing the tests with those in C ++, but if you tell me that also work well with Lazarus prefer those

It is for Delphi, which obviously works in with FPC (Delphi mode)
What I have is very old. I think the link of the source is in the header of OpenCV.pas:
Quote
(*********************************************************************
     *                                                                   *
     *  Borland Delphi 4,5,6,7 API for                                   *
     *  Intel Open Source Computer Vision Library                        *
     *                                                                   *
     *                                                                   *
     *  Portions created by Intel Corporation are                        *
     *  Copyright (C) 2000, Intel Corporation, all rights reserved.      *
     *                                                                   *
     *  The original files are: CV.h, CVTypes.h, highgui.h               *       
     *                                                                   *
     *                                                                   *
     *  The original Pascal code is: OpenCV.pas,  released 29 May 2003.  *                                 
     *                                                                   *
     *  The initial developer of the Pascal code is Vladimir Vasilyev    *       
     *                  home page : http://www.nextnow.com               *
     *                  email     : Vladimir@nextnow.com                 *
     *                              W-develop@mtu-net.ru                 *
     *                                                                   *
     *  Contributors: Andrey Klimov                                      *
     *********************************************************************
     *  Expanded version to use many other functions                     *
     *  G. De Sanctis - 9/2005                                           *
     *                                                                   *
     *********************************************************************
     *                                                                   *
     *                                                                   *
     *  The contents of this file are used with permission, subject to   *
     *  the Mozilla Public License Version 1.1 (the "License"); you may  *
     *  not use this file except in compliance with the License. You may *
     *  obtain a copy of the License at                                  *
     *  http://www.mozilla.org/MPL/MPL-1.1.html                          *
     *                                                                   *
     *  Software distributed under the License is distributed on an      *
     *  "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or   *
     *  implied. See the License for the specific language governing     *
     *  rights and limitations under the License.                        *
     *                                                                   *
     *********************************************************************)

Also with your example I can do transforms Hough.
but how to extract the coordinates of the rectangles obtained?
Because in the end I need to get those

You have every two end points of each line, you can guess which rectangle you are looking for. Then check how the percentage of orange color in its area.

I attached the related files.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Rectangular isolation
« Reply #17 on: February 05, 2016, 10:10:35 pm »
Not run on linux.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Rectangular isolation
« Reply #18 on: February 06, 2016, 07:59:32 pm »
Not run on linux.

Giandomenico said:
Quote
This is a version of example program lkdemo (slighty modified from one of the examples coming with OpenCV) adapted to Freepascal. Now the OpenCV and IPL headers have compiler defines to adapt to Linux other then Windows.
Because lkdemo has a GUI output, I have chosen to use Freepascal with MSEGUI library (MSEGUI home), because it's very light, has a very good IDE, and it's straightforward to port to every Linux distro not requiring special GUI libraries (as Qt, GTK, ...). Maybe Lazarus is equally good, but I have not tested (although in the OpenCV header there are defines also for Lazarus in the BMP to OpenCV images conversion functions).
The program was tested on Xubuntu 10.10 with OpenCV 2.1 downloaded directly from the Ubuntu repository. I found some access violation problems with cvFindCornerSubPix function, but Freepascal shines managing that without crashing the program, wherever the original C++ program, recompiled on the same Xubuntu machine, refuses to run.
The ZIP archive contains a project for the MSEIDE tool. Unpack it in a directory, and open and compile in Windows or Linux without any modifications (having previously installed Freepascal and MSEGUI+MSEIDE, of course!

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Rectangular isolation
« Reply #19 on: March 07, 2016, 06:51:48 am »
hello,
success to convert lkdemo (points tracking on video) from msegui version to Lazarus 
lazarus 1.6 windows 32 bits   windows 7
opencv Windows 32 bits  2.31
i have replaced capture from camera by capture from file :
Code: Pascal  [Select][+][-]
  1. //      capture := cvCaptureFromCAM(0);
  2.         capture := cvCaptureFromFile(PChar('f:\temp\videos\test.mp4'));

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

JZS

  • Full Member
  • ***
  • Posts: 194
Re: Rectangular isolation
« Reply #20 on: March 07, 2016, 09:55:24 am »
Hello everyone,

I just came across this thread and realized that I need to use some functionality from OpenCV like "cvCaptureFromCAM(0);", but the original source is for MSEGUI.

I tried VFW and works OK but with strange behavior which is I can click on "Connect" to get connected which running from the IDE but once I execute the exe "Connect" brings a dialog to select the WebCam to be used. So far that is acceptable, although is different when running from the IDE, but what is strange is this, it shows this dialog several times (three to nine times) to be able to connect.

I attached the related files.

I got error when trying to compile the OpenCV files, precisely at IPL.pas
Code: Pascal  [Select][+][-]
  1. ...
  2. function iplGetLibVersion;              external iplDLL;
  3. ...
  4. ipl.pas(2979,26) Fatal: Syntax error, ":" expected but ";" found


Sorry for hijacking someone else's thread but What do I need to do to make the OpenCV working on Lazarus 1.6/Windows.

Thank you
I use recent stable release

 

TinyPortal © 2005-2018