Beispiel #1
0
 def doProcess(self, pic_dir, oid):
     history = HistoryService()
     rr, rg, ro = history.queryRatio(oid)
     resultab = self.predictAB(rr, rg)
     resultall = self.predictAll(rr, rg, ro)
     history.updateResult(oid, resultab, resultall)
     print("Chain 003 execute")
Beispiel #2
0
 def doProcess(self, pic_dir, oid):
     pic_path1 = pic_dir + "01.jpg"
     pic_path2 = pic_dir + "02.jpg"
     self.ContourRecognition(pic_path1, pic_path2)
     history = HistoryService()
     history.changeStatus(oid, 2)
     print("Chain 001 execute")
     self.next.doProcess(pic_dir, oid)
Beispiel #3
0
    def doChain(self, aid, imgfile):
        history = HistoryService()
        oid, tmpdir = history.createInitOrder(aid)
        tmpdir2 = tmpdir + "01.jpg"
        fobj = open(tmpdir2, 'wb')
        fobj.write(imgfile.read())
        fobj.close()

        process = ProcessChain()
        process.doProcess(tmpdir, oid)
Beispiel #4
0
def pageHistory(request):
    aid = request.session.get('BMP_id')
    if aid == None:
        return render(request, "login.html")
    else:
        user_name = request.session.get('BMP_user')
        history_obj = HistoryService()
        querydata = history_obj.queryData(aid, 0)
        return render(request, "./history.html", {
            "user_name": user_name,
            "querydata": querydata,
            "currentpage": "1"
        })
Beispiel #5
0
    def doProcess(self, pic_dir, oid):
        pic_path1 = pic_dir + "03.jpg"
        pic_path2 = pic_dir + "04.jpg"
        redSum = float(
            '%.6f' %
            (self.RedFilter(pic_path1, pic_dir + "02.jpg") / 160000.0))
        greenSum = float(
            '%.6f' %
            (self.GreenFilter(pic_path2, pic_dir + "02.jpg") / 160000.0))
        print(redSum)

        history = HistoryService()
        print("Chain 002 execute")
        history.updateRatio(oid, redSum, greenSum)
        self.next.doProcess(pic_dir, oid)
Beispiel #6
0
def doUpload(request):
    if request.method == "POST":
        aid = request.session.get('BMP_id')
        user_name = request.session.get('BMP_user')

        imgfile = request.FILES.get('img')

        picprocess = PicService()
        picprocess.doChain(aid, imgfile)

        history_obj = HistoryService()
        querydata = history_obj.queryData(aid, 0)
        return render(request, "./history.html", {
            "user_name": user_name,
            "querydata": querydata
        })
    else:
        return HttpResponse("NotSupport")
Beispiel #7
0
def doResult(request):
    if request.method == "POST":
        aid = request.session.get('BMP_id')
        if aid == None:
            return render(request, "login.html")
        else:
            oid = request.POST.get("oid")
            print(oid)
            user_name = request.session.get('BMP_user')
            history_obj = HistoryService()
            resulta, resultb, resultall = history_obj.queryResult(oid)
            return render(
                request, "./result.html", {
                    "user_name": user_name,
                    "aid": aid,
                    "oid": oid,
                    'resulta': resulta,
                    'resultall': resultall
                })

    else:
        return HttpResponse("NotSupport")
Beispiel #8
0
def doHistory(request):
    if request.method == "POST":
        aid = request.session.get('BMP_id')
        if aid == None:
            return render(request, "login.html")
        else:
            user_name = request.session.get('BMP_user')
            history_obj = HistoryService()

            currentpage = request.POST.get("currentpage")
            nextpage = request.POST.get("nextpage")
            if currentpage == "1":
                if nextpage == "-1":
                    querydata = history_obj.queryData(aid, 0)
                    return render(
                        request, "./history.html", {
                            "user_name": user_name,
                            "querydata": querydata,
                            "currentpage": "1"
                        })
                else:
                    querydata = history_obj.queryData(aid,
                                                      int(currentpage) * 10)
                    return render(
                        request, "./history.html", {
                            "user_name": user_name,
                            "querydata": querydata,
                            "currentpage": int(currentpage) + int(nextpage)
                        })
            else:
                if nextpage == "-1":
                    querydata = history_obj.queryData(
                        aid, (int(currentpage) - 2) * 10)
                    return render(
                        request, "./history.html", {
                            "user_name": user_name,
                            "querydata": querydata,
                            "currentpage": int(currentpage) + int(nextpage)
                        })
                else:
                    querydata = history_obj.queryData(aid,
                                                      int(currentpage) * 10)
                    return render(
                        request, "./history.html", {
                            "user_name": user_name,
                            "querydata": querydata,
                            "currentpage": int(currentpage) + int(nextpage)
                        })
    else:
        return HttpResponse("NotSupport")
Beispiel #9
0
    order.aid = a1
    order.ostatus = "1"
    order.odir = "/static/data/10/"

    order.save()

    order.odir = "/static/data/" + str(a1.aid) + "/" + str(order.oid)
    print(order.odir)
    order.save()


def queryOrder():
    D = Order.objects.filter(aid="16")
    print(len(D))
    data = serializers.serialize("json", Order.objects.filter(aid="16"))
    print(len(data))
    print(data)

    # orders = Order.objects.filter(aid="16")
    # for order in orders:
    #     print(order.toJSON())


if __name__ == "__main__":
    # queryOrder()
    # a = list(range(0, 9, 1))
    # print(a[2:3])

    h = HistoryService()
    print(h.queryRatio("10"))