X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/canny.git/blobdiff_plain/6642f8003d7e1cdfb33d3da88fb41702eb237af2..51c827b374614757c68f7d7cd8d799eb46f477e0:/stc/exp/raphus/sobel555_for_ensemble.py diff --git a/stc/exp/raphus/sobel555_for_ensemble.py b/stc/exp/raphus/sobel555_for_ensemble.py index 5252647..4a31c20 100644 --- a/stc/exp/raphus/sobel555_for_ensemble.py +++ b/stc/exp/raphus/sobel555_for_ensemble.py @@ -429,7 +429,7 @@ def compute_filter_canny(level,image,MsgLen): processed= array(processed.getdata()).flatten() List7=set(compute_list_bit_to_change(100,processed)) - #nb_bit_embedded=(512*512/10)+40 + nb_bit_embedded=max(2*MsgLen,int(len(List3)/MsgLen)*MsgLen) print "nb_bit_embedded",nb_bit_embedded AvailablePixel3=List3 @@ -489,10 +489,115 @@ def compute_filter_canny(level,image,MsgLen): +def verifie(fileout,leng_msg,Message,): + global M,X + bit_to_read = 1 + dd2 = im.open(fileout) + dd2 = dd2.convert('RGB') + red2, green, blue = dd2.split() + level2=red2.copy() + + [List_bit_to_change2,Weight2]=compute_filter_canny(level2,dd2,leng_msg) + + + level2= array(level2.getdata()).flatten() + + print "support2",len(List_bit_to_change2) + print "message2",len(Message) + print "weight2",len(Weight2) + + alpha = float(len(List_bit_to_change2))/len(Message) + assert alpha >= 2 + index = min(int(alpha),9) + H_hat2 = { + 2 : [71,109], + 3 : [95, 101, 121], + 4 : [81, 95, 107, 121], + 5 : [75, 95, 97, 105, 117], + 6 : [73, 83, 95, 103, 109, 123], + 7 : [69, 77, 93, 107, 111, 115, 121], + 8 : [69, 79, 81, 89, 93, 99, 107, 119], + 9 : [69, 79, 81, 89, 93, 99, 107, 119, 125] + }[index] + + + print H_hat2 + + + Stc_message2=[getBit(level2[l],bit_to_read) for l in List_bit_to_change2] + LL2=list(List_bit_to_change2) + + """ + print "Level",max([level2[l]-level[l] for l in xrange(len(Stc_message2))]) + print "List bit to change",max([LL2[l]-LL1[l] for l in xrange(len(Stc_message))]) + print "Stc message", max([Stc_message[l]-Stc_message2[l] for l in xrange(len(Stc_message))]) + """ + Message2 = [x%2 for x in prod(H_hat2,len(Message),Stc_message2)] + level2=Message2 + +# print "mesg",Message +# print "mesg2",Message2 + + l=0 + val_mod2=0 + list_msg=[] + decoded_msg="" + + bbs = BlumBlumShub(); + bbs.setN(M) + bbs.setSeed(X) -def mystego(filein, fileout): + List_random=[] + while len(List_random)=leng_error*8 and val_mod2= 2 - index = min(int(alpha),9) - H_hat2 = { - 2 : [71,109], - 3 : [95, 101, 121], - 4 : [81, 95, 107, 121], - 5 : [75, 95, 97, 105, 117], - 6 : [73, 83, 95, 103, 109, 123], - 7 : [69, 77, 93, 107, 111, 115, 121], - 8 : [69, 79, 81, 89, 93, 99, 107, 119], - 9 : [69, 79, 81, 89, 93, 99, 107, 119, 125] - }[index] - - - print H_hat,H_hat2 - - - Stc_message2=[getBit(level2[l],bit_to_read) for l in List_bit_to_change2] - LL1=list(List_bit_to_change); - LL2=list(List_bit_to_change2) - - print "Level",max([level2[l]-level[l] for l in xrange(len(Stc_message2))]) - print "List bit to change",max([LL2[l]-LL1[l] for l in xrange(len(Stc_message))]) - print "Stc message", max([Stc_message[l]-Stc_message2[l] for l in xrange(len(Stc_message))]) - - Message2 = [x%2 for x in prod(H_hat2,len(Message),Stc_message2)] - level2=Message2 - -# print "mesg",Message -# print "mesg2",Message2 - print equiv(Message,Message2) - print "fini" - l=0 - val_mod2=0 - list_msg=[] - decoded_msg="" - - MessageDecoded2=[(int(Message2[l])^int(List_random[l])) for l in xrange(len(Message2))] -# print conv_list_bit(''.join([`MessageDecoded2[i]` for i in xrange(leng_error*8)])) -# print int(conv_list_bit(''.join([`MessageDecoded2[i]` for i in xrange(leng_error*8)]))) - - print "MessageDecoded2",MessageDecoded2 - print conv_list_bit(''.join([`MessageDecoded2[i]` for i in xrange(len(Message2))])) - - - - - - -# for l in List_bit_to_change2: -# if(val_mod2=leng_error*8 and val_mod2