ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Image detection functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Detects different elements in an image: object, faces, etc, ... This detection is achieved through artificial intelligence (AI).
Example
tabElément is array of 1 int
tabElément[1] = aidMotorbike
tabIARésultatImage is array of aiImageResult
tabIARésultatImage = AIDetect(IMG_SansNom1, tabElément)
IF tabIARésultatImage.Count = 0 THEN RETURN
 
iImage is Image = IMG_SansNom1
dStartDrawing(iImage, dNoErase + dWithOpacity)
 
InitRandom(1) // Valeur fixe pour avoir toujours les mêmes couleurs de rectangles
 
nMarge is int = CoordinateEditorToScreen(5)
cCouleur is Color
nIndice is int
iElement is aiImageResult
FOR EACH ÉLÉMENT iElement OF tabIARésultatImage
nIndice ++
cCouleur.Red = Random(0,170)
cCouleur.Green = Random(0,170)
cCouleur.Blue = Random(0,170)
dBackground(iImage, White, 0, 0, 0)
dPen(iImage, cCouleur, 0, CoordinateEditorToScreen(5), 128)
dPolygon(iImage,iElement.Polygon)
nXCentre is int
nYCentre is int
IF iElement.Polygone.Point[1].X < iElement.Polygone.Point[2].X THEN
nXCentre = (iElement.Polygone.Point[1].X + iElement.Polygone.Point[2].X)/2
nYCentre = (iElement.Polygone.Point[1].Y + iElement.Polygone.Point[3].Y)/2
ELSE
nXCentre = (iElement.Polygone.Point[1].X + iElement.Polygone.Point[4].X)/2
nYCentre = (iElement.Polygone.Point[1].Y + iElement.Polygone.Point[2].Y)/2
END
 
dPen(iImage, cCouleur, 0, 2, 200)
dBackground(iImage, White, 0, 0, 200)
dRectangle(iImage, nXCentre - nMarge, nYCentre - nMarge, nXCentre + nMarge, nYCentre + nMarge)
dPen(iImage, cCouleur, 0, 1, 255)
END
IMG_SansNom1 = iImage
Syntax
<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 indicate the elements to be found 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.
    aidYoloModelSearches 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.
Remarks
  • 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 they 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: wd300ia.dll
Minimum version required
  • Version 27
This page is also available for…
Comments
Problema funcion AidTruck
existe un error al utilizar esta función, arroja un problema yolov4.weights y en otras como aidMotorbike tambien, solo he logrado acceder a la funcion con aidFace
PABLO Hernandez
10 Apr. 2023

Last update: 06/17/2024

Send a report | Local help