اذهب إلى المحتوى

Zeina Almakdisi

الأعضاء
  • المساهمات

    168
  • تاريخ الانضمام

  • تاريخ آخر زيارة

2 متابعين

آخر الزوار

4025 زيارة للملف الشخصي

إنجازات Zeina Almakdisi

عضو نشيط

عضو نشيط (3/3)

151

السمعة بالموقع

3

إجابات الأسئلة

  1. اذا قمت بتفعيل خدمة دفع PayPal ضمن مشروع دجانغو وثبتت مكتبة Paypal IPN باستخدام pip install django-PayPal وظهر جدول جديد في صفحة admin يحتوي على معلومات الدفع هل هكذا تم كل شيء بنحاح ولااحتاج خطوات اضافية للحصول على إشعارات الدفع
  2. مرحبا اقوم بانشاء صفحة شخصية لكل موظف باستخدام Django Api لكن لدي مشكلة هو عند تعبئة بيانات الموظف لاتظهر في مربع اختيار user اسماء المستخدمين الذي تم انشاء حسابات لهم علما انني استخدم User الذي تم انشاؤه تلقائيا في دجانغو (الصورة للتوضيح) class Employee(models.Model): id = models.IntegerField(primary_key=True) user = models.OneToOneField(User, on_delete=models.CASCADE) name = models.CharField(max_length=255) age = models.IntegerField() gender = models.CharField(max_length=255) image = models.CharField(max_length=255) departmentId = models.ForeignKey('Department', on_delete=models.CASCADE) securityServer = models.ForeignKey('SecurityServer', on_delete=models.CASCADE) //////////////////////////////// from .serializer import UserSerializer,EmployeeSerializer from django.db import connections from rest_framework import serializers from rest_framework.response import Response class EmployeeAPIView(APIView): permission_classes = [permissions.IsAuthenticated] def get(self, request): user = self.request.useruser = self.request.user employees = Employee.objects.filter(user=user) # employees = Employee.objects.all() serializer = EmployeeSerializer(employees, many=True) return Response(serializer.data) ////////////////////////////////////// from rest_framework import serializers class EmployeeSerializer(serializers.ModelSerializer): user = serializers.PrimaryKeyRelatedField(queryset=User.objects.all()) class Meta: model = Employee fields = '__all__' class EmployeeAPIView(APIView): permission_classes = [permissions.IsAuthenticated] def get(self, request): employees = Employee.objects.all() serializer = EmployeeSerializer(employees, many=True) return Response(serializer.data)
  3. مرحبا ضمن مشروع دجانغو احتاج الى تفعيل خدمة الدفع الالكتروني apple pay اذا كنت املك IBAN هل احتاج الدخول للموقع الرسمي والتسجيل او فقط استخدم رقم IBAN مباشرة؟ واحتاج الى معلومات اكثر عن خطوات تفعيل ابل باي
  4. مرحبا اعمل على مشروع برمجي للدراسة فقط.. احتاج فيه الى استخدام اكثر من سيرفر مثل سيرفر لكميرات المراقبة وسيرفر لمعلومات خاصة وهكذا هل يوجد مواقع او افكار تدعم هذه الفكرة؟
  5. شكرا لك بعد تطبيق التعديلات ظهر الخطأ التالي cv2.imwrite(output_image_path, image) cv2.error: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp:787: error: (-215:Assertion failed) !_img.empty() in function 'cv::imwrite' علما أنه عند طباعة print(image_path) يظهر الخرج على شكل مصفوفات image = cv2.imread(image_path) print(image) يظهر الخرج none فقط cv2.imwrite(output_image_path, image)
  6. مرحبا... يظهر الخطأ التالي : output_image_path = "object-detection-" +image_path.split('.')[0] + ".jpg" AttributeError: 'numpy.ndarray' object has no attribute 'split' في الجزء من الكود: output_image_path = "object-detection-" +image_path.split('.')[0] + ".jpg" cv2.imwrite(output_image_path, image) cv2.destroyAllWindows() وعند تحويل image_path الى سلسلة نصية str(image_path) يظهر الخطأ التالي: cv2.error: OpenCV(4.8.0): -1 : error: (-5:Bad argument) in function 'imwrite' > Overload resolution failed: > - img is not a numpy array, neither a scalar > - Expected Ptr<cv::UMat> for argument 'img' جربت العديد من الحلول ولم ينجح
  7. شكرا لك قمت بتطبيق الخطوات اصبح يظهر الخطأ التالي image = cv2.imread(image_path) TypeError: Can't convert object to 'str' for 'filename' يشير الى : def video_detector(image_path): while True: image = cv2.imread(image_path)#################### هنااا Width = image.shape[1] Height = image.shape[0]
  8. مرحبا.. اعمل على خوارزمية yolov3 لاكتشاف الاشياء احاول تعديل الكود ليصبح قادر على معالجة أكثر من صورة مدخلة وحفظهم وضعت تعليقات لتوضيح مكان الخطأ import cv2 from pathlib import Path import pafy import argparse import numpy as np classesf="yolov3.txt" weights="yolov3.weights" config="yolov3.cfg" scale=0.00392 classes=None with open(classesf,'r') as f: classes=[line.strip() for line in f.readlines()] COLORS =np.random.uniform(0,255,size=(len(classes),3)) net=cv2.dnn.readNet(weights,config) ############################################التعديل هنا لادخال الصور ap = argparse.ArgumentParser() ap.add_argument('-i', '--images',nargs='+', default=["sam.jpg"], help = 'path to input image') ap.add_argument('-c', '--config', default="yolov3.cfg", help = 'path to yolo config file') ap.add_argument('-w', '--weights', default="yolov3.weights", help = 'path to yolo pre-trained weights') ap.add_argument('-cl', '--classes', default="yolov3.txt", help = 'path to text file containing class names') args =vars(ap.parse_args()) for image_path in args['images']: image = cv2.imread('Images/frame*.jpg') #################################################################### def get_output_layers(net): layer_names = net.getLayerNames() try: output_layers = [layer_names[i - 1] for i in net.getUnconnectedOutLayers()] except: output_layers = [layer_names[i[0] - 1] for i in net.getUnconnectedOutLayers()] return output_layers def draw_prediction(img, class_id, confidence, x, y, x_plus_w, y_plus_h): label = str(classes[class_id]) color = COLORS[class_id] cv2.rectangle(img, (x,y), (x_plus_w,y_plus_h), color, 2) cv2.putText(img, label, (x-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2) def video_detector(image_path): while True: image = cv2.imread(image_path) Width = image.shape[1] Height = image.shape[0] blob = cv2.dnn.blobFromImage(image, 0.00392, (416,416), (0,0,0), True, crop=False) net.setInput(blob) outs = net.forward(get_output_layers(net)) class_ids = [] confidences = [] boxes = [] conf_threshold = 0.5 nms_threshold = 0.4 scale = 0.00392 classes = None for out in outs: for detection in out: scores = detection[5:] class_id = np.argmax(scores) confidence = scores[class_id] if confidence > 0.5: center_x = int(detection[0] * Width) center_y = int(detection[1] * Height) w = int(detection[2] * Width) h = int(detection[3] * Height) x = center_x - w / 2 y = center_y - h / 2 class_ids.append(class_id) confidences.append(float(confidence)) boxes.append([x, y, w, h]) # print(class_id) indices = cv2.dnn.NMSBoxes(boxes, confidences, conf_threshold, nms_threshold) for i in indices: try: box = boxes[i] except: i = i[0] box = boxes[i] x = box[0] y = box[1] w = box[2] h = box[3] draw_prediction(image, class_ids[i], confidences[i], round(x), round(y), round(x+w), round(y+h)) cv2.imshow("object detection", image) cv2.waitKey() if cv2.waitKey(1) & 0xff ==ord('q'): break cv2.imwrite("object-detection.jpg", image) output_image_path = "object-detection-" + image_path.split('.')[0] + ".jpg" cv2.imwrite(output_image_path, image) cv2.destroyAllWindows() if __name__ == "__main__": video_detector(args['image'])#############image يظهر الخطأ هنا عند تمرير
  9. مرحبا.. قمت بانشاء متجرالكتروني هل يمكنني ربطه مع موقع الف ياء بحيث اي عميل يفتح حساب في المتجر يفتح عندي له حساب في برنامج المبيعات بموقع الف ياء ارجو التنويه او طرح افكار للمساعدة
  10. لدي كود يقوم بمعالجة الصور المدخلة وتحديد ماهية الاشياء في الصورة مااحتاجه هو معرفة كم شخص في الصورة لعمل احصائية خرج الكود (الصورة): ارجو المساعدة على اقتراح كيف يمكن معرفة العدد ؟؟ لاستطيع تخزينه في قاعدة البيانات
  11. مرحبا.. لدي خوارزمية yolo v3 الذي تقوم بتحديد ماهية الاشياء الموجودة في الصورة لايوجد بها مشاكل لكن في كل مرة اريد تشغيل الكود يجب ادخال مسار الملفات التالة ضمن terminal : python yolo.py --image dog.jpg --config yolov3.cfg --weights yolov3.weights --classes yolov3.txt هل يمكنني تثبيتهم ضمن الكود؟؟؟؟ import cv2 import pafy import argparse import numpy as np image="dog.jpg" classesf="yolov3.txt" weights="yolov3.weights" config="yolov3.cfg" scale=0.00392 classes=None with open(classesf,'r') as f: classes=[line.strip() for line in f.readlines()] COLORS =np.random.uniform(0,255,size=(len(classes),3)) net=cv2.dnn.readNet(weights,config) ap = argparse.ArgumentParser() ap.add_argument('-i', '--image', required=True, help = 'path to input image') ap.add_argument('-c', '-c/--yolov3.cfg', required=True, help = 'path to yolo config file') ap.add_argument('-w', '--weights', required=True, help = 'path to yolo pre-trained weights') ap.add_argument('-cl', '--classes', required=True, help = 'path to text file containing class names') args = ap.parse_args() def get_output_layers(net): layer_names = net.getLayerNames() try: output_layers = [layer_names[i - 1] for i in net.getUnconnectedOutLayers()] except: output_layers = [layer_names[i[0] - 1] for i in net.getUnconnectedOutLayers()] return output_layers def draw_prediction(img, class_id, confidence, x, y, x_plus_w, y_plus_h): label = str(classes[class_id]) color = COLORS[class_id] cv2.rectangle(img, (x,y), (x_plus_w,y_plus_h), color, 2) cv2.putText(img, label, (x-10,y-10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2) image = cv2.imread(args.image) def video_detector(): while True: image = cv2.imread(args.image) Width = image.shape[1] Height = image.shape[0] blob = cv2.dnn.blobFromImage(image, 0.00392, (416,416), (0,0,0), True, crop=False) net.setInput(blob) outs = net.forward(get_output_layers(net)) class_ids = [] confidences = [] boxes = [] conf_threshold = 0.5 nms_threshold = 0.4 scale = 0.00392 classes = None for out in outs: for detection in out: scores = detection[5:] class_id = np.argmax(scores) confidence = scores[class_id] if confidence > 0.5: center_x = int(detection[0] * Width) center_y = int(detection[1] * Height) w = int(detection[2] * Width) h = int(detection[3] * Height) x = center_x - w / 2 y = center_y - h / 2 class_ids.append(class_id) confidences.append(float(confidence)) boxes.append([x, y, w, h]) indices = cv2.dnn.NMSBoxes(boxes, confidences, conf_threshold, nms_threshold) for i in indices: try: box = boxes[i] except: i = i[0] box = boxes[i] x = box[0] y = box[1] w = box[2] h = box[3] draw_prediction(image, class_ids[i], confidences[i], round(x), round(y), round(x+w), round(y+h)) cv2.imshow("object detection", image) cv2.waitKey() if cv2.waitKey(1) & 0xff ==ord('q'): break cv2.imwrite("object-detection.jpg", image) cv2.destroyAllWindows() conn = psycopg2.connect("dbname=Management_Center user=postgres password=123456") [postgresql] host=localhost database=Management_Center user=postgres password=123456 if __name__ == "__main__": video_detector()
  12. مرحبا.. لدي كود برمجي يستخرج صور من الفيديوهات يعمل دون مشاكل لكن مااحتاجه هو الحصول على صورة كل 30 ثانية بدلا من كل 1 ثانية # from video2images import Video2Images import cv2 vcap = cv2.VideoCapture() # set frame width and height vcap.set(cv2.CAP_PROP_FRAME_WIDTH, 480) vcap.set(cv2.CAP_PROP_FRAME_HEIGHT, 640) vcap.open(100) vs=cv2.VideoCapture('VideoDoor//aaa.mp4')###input prop=cv2.CAP_PROP_FRAME_COUNT total=int(vs.get(prop)) print(" [INFO] {} total frame in video".format(total)) ret, img=vs.read() print(ret) count=0 while ret: cv2.imwrite("Images//frame%d.jpg" %count , img) ###output foldir ret, img=vs.read() print('Read a new frame:',count,ret) count += 1
  13. مرحبا اقوم ببناء تطبيق اندرويد باستخدام Django & React ماهي الاصدارات الذي ينصح بالعمل عليها لعدم حدوث تضارب بين الحزم؟ ( اصدار بايثون واصدار react متوافقين)؟
  14. مرحبا لدي استفسار هل يمكنني بناء تطبيق يعمل على اجهزة الاندرويد باستخدام دجانغو و Angular وهل يوجد نصائح افضل
×
×
  • أضف...