![](/img/trans.png)
[英]How to detect the collision of two drawn objects in c# 2010 express
[英]How to detect objects in an image in c#?
我正在建立一個C#項目來檢測圖像中的所有對象,我不希望它檢測到這些對象是什么,我只是希望它檢測對象在圖像中的位置。
我已經嘗試了許多方法來做到這一點 (使用imageai python庫,然后在c#中使用此腳本)和此 (使用Alturos.Yolo庫)教程,但是這些教程僅檢測已知對象,而未檢測到對象的位置。對象,如果不知道這個對象是什么。
我需要的是檢測對象的位置,無論它是否識別該對象。
例如在這張圖片中
它僅檢測可識別其類型的對象,但我希望它檢測圖像中的所有對象。
python代碼:
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
detector.loadModel()
detections =
detector.detectObjectsFromImage(input_image=os.path.join(execution_path , rel_path ,file_name), output_image_path=os.path.join(execution_path ,new_file_name))
for eachObject in detections:
print(eachObject["name"] , " : " , eachObject["percentage_probability"] ," : " ,eachObject["box_points"] )
使用Alturos.Yolo庫代碼:
var configurationDetector = new ConfigurationDetector();
var config = configurationDetector.Detect();
using (var yoloWrapper = new YoloWrapper(config))
{
using (MemoryStream ms = new MemoryStream())
{
pictureBox1.Image.Save(ms, ImageFormat.Png);
var items = yoloWrapper.Detect(ms.ToArray());
yoloItemBindingSource.DataSource = items;
arr = items.ToArray();
}
}
任何人都可以幫忙或推薦其他方式嗎?
這是一個類似的問題,其中的一些答案可能會對您有所幫助。 這是我找到的一些選項:
一些方法:
* ColorFiltering
* ChannelFiltering
* HSLFiltering
* YCbCrFiltering
* EuclideanColorFiltering
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.