Home | Sign in | English EN
New WINDEV and WEBDEV 27 feature!
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Detects different elements in an image: object, faces, etc, ... This detection is achieved through artificial intelligence (AI).
arrElement is array of 1 int
arrElement[1] = aidMotorbike
arrAIImageResult is array of aiImageResult
arrAIImageResult = AIDetect(IMG_NoName1, arrElement)
IF arrAIImageResult.Count = 0 THEN RETURN
iImage is Image = IMG_NoName1
dStartDrawing(iImage, dNoErase + dWithOpacity)
InitRandom(1) //Fixed value to always have the same rectangle colors
nMargin is int = CoordinateEditorToScreen(5)
cColor is Color
nIndex is int
iElement is aiImageResult
FOR EACH ÉLÉMENT iElement OF arrAIImageResult
nIndex ++
cColor.Red = Random(0,170)
cColor.Green = Random(0,170)
cColor.Blue = Random(0,170)
dBackground(iImage, White, 0, 0, 0)
dPen(iImage, cColor, 0, CoordinateEditorToScreen(5), 128)
nXCenter is int
nYCenter is int
IF iElement.Polygon.Point[1].X < iElement.Polygon.Point[2].X THEN
nXCenter = (iElement.Polygon.Point[1].X + iElement.Polygon.Point[2].X)/2
nYCenter = (iElement.Polygon.Point[1].Y + iElement.Polygon.Point[3].Y)/2
nXCenter = (iElement.Polygon.Point[1].X + iElement.Polygon.Point[4].X)/2
nYCenter = (iElement.Polygon.Point[1].Y + iElement.Polygon.Point[2].Y)/2
dPen(iImage, cColor, 0, 2, 200)
dBackground(iImage, White, 0, 0, 200)
dRectangle(iImage, nXCenter - nMargin, nYCenter - nMargin, nXCenter + nMargin, nYCenter + nMargin)
dPen(iImage, cColor, 0, 1, 255)
IMG_NoName1 = iImage
<Result> = AIDetect(<Image> [, <Array of constants>])
<Result>: Array of aiImageResult
Array of aiImageResult variables containing the different elements found.
<Image>: Character string
Image to be analyzed. The image can correspond to:
  • a variable of type Image,
  • the name and path of the image,
  • the name and path of a PDF file,
  • an Image memo item,
  • an Image control.
<Array of constants>: Optional array
Array of constants used to to define the elements sought in the image:
  • Constants used to search for all the elements that belong to a model:
    aidFaceModelDetects faces in the image.
    aidlLicensePlateModelDetects license plates in the image.
    aidYoloModelSearch for all the objects the YOLO model is trained to detect in the image (see below).

  • Constants used to find a specific object that can be detected by the YOLO model:
    aidAirplaneDetects planes in the image.
    aidAppleDetects apples in the image.
    aidBackpackDetects backpacks in the image.
    aidBananaDetects bananas in the image.
    aidBaseballBatDetects baseball bats in the image.
    aidBaseballGloveDetects baseball gloves in the image.
    aidBearDetects bears in the image.
    aidBedDetects beds in the image.
    aidBenchDetects benches in the image.
    aidBicycleDetects bicycles in the image.
    aidBirdDetects birds in the image.
    aidBoatDetects boats in the image.
    aidBookDetects books in the image.
    aidBottleDetects bottles in the image.
    aidBowlDetects bowls in the image.
    aidBroccoliDetects pieces of broccoli in the image.
    aidBusDetects buses in the image.
    aidCakeDetects cakes in the image.
    aidCarDetects cars in the image.
    aidCarrotDetects carrots in the image.
    aidCatDetects cats in the image.
    aidCellphoneDetects cellphones in the image.
    aidChairDetects chairs in the image.
    aidClockDetects clocks in the image.
    aidCowDetects cows in the image.
    aidCupDetects cups in the image.
    aidDiningTableDetects dining tables in the image.
    aidDogDetects dogs in the image.
    aidDonutDetects donuts in the image.
    aidElephantDetects elephants in the image.
    aidFaceDetects faces in the image.
    aidFireHydrantDetects fire hydrants in the image.
    aidForkDetects forks in the image.
    aidFrisbeeDetects frisbees in the image.
    aidGiraffeDetects giraffes in the image.
    aidHairDryerDetects hair dryers in the image.
    aidHandbagDetects handbags in the image.
    aidHorseDetects horses in the image.
    aidHotdogDetects hot dogs in the image.
    aidKeyboardDetects keyboards in the image.
    aidKiteDetects kites in the image.
    aidKnifeDetects knives in the image.
    aidLaptopDetects laptops in the image.
    aidMicrowaveDetects microwave ovens in the image.
    aidMotorbikeDetects motorbikes in the image.
    aidMouseDetects mice in the image.
    aidOrangeDetects oranges in the image.
    aidOvenDetects ovens in the image.
    aidParkingMeterDetects parking meters in the image.
    aidPersonDetects people in the image.
    aidPizzaDetects pizzas in the image.
    aidPottedPlantDetects potted plants in the image.
    aidRefrigeratorDetects refrigerators in the image.
    aidRemoteDetects remote controls in the image.
    aidSandwichDetects sandwiches in the image.
    aidScissorsDetects scissors in the image.
    aidSheepDetects sheep in the image.
    aidSinkDetects sinks in the image.
    aidSkateboardDetects skateboards in the image.
    aidSkiDetects skis in the image.
    aidSnowboardDetects snowboards in the image.
    aidSofaDetects sofas in the image.
    aidSpoonDetects spoons in the image.
    aidSportsBallDetects sports balls in the image.
    aidStopSignDetects stop signs in the image.
    aidSuitcaseDetects suitcases in the image.
    aidSurfboardDetects surfboards in the image.
    aidTeddyBearDetects teddy bears in the image.
    aidTennisRacketDetects tennis rackets in the image.
    aidTieDetects ties in the image.
    aidToasterDetects toasters in the image.
    aidToiletDetects toilets in the image.
    aidToothbrushDetects toothbrushes in the image.
    aidTrafficLightDetects traffic lights in the image.
    aidTrainDetects trains in the image.
    aidTruckDetects trucks in the image.
    aidTvDetects TVs in the image.
    aidUmbrellaDetects umbrellas in the image.
    aidVaseDetects vases in the image.
    aidWineGlassDetects wine glasses in the image.
    aidZebraDetects zebras in the image.

  • Constants used for specific searches:
    aidFaceDetects faces in the image. Model used: face detector.
    aidLicensePlateDetects license plates in the image. Model used: license plate recognition.
  • Depending on the desired combination of elements, multiple models can be used.
  • Using multiple constants does not increase the execution time of the function, if these constants belong to the same model.
  • The YOLO model is automatically copied to the executable directory. The other models are integrated in the library of the application.
Related Examples:
WD Object Detection Training (WINDEV): WD Object Detection
[ + ] This example shows how to use AIDetect.
Component: wd270ia.dll
Minimum version required
  • Version 27
This page is also available for…
Click [Add] to post a comment