-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc3a271
commit a79b143
Showing
119 changed files
with
763,196 additions
and
3,566 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Intensity Transform | ||
|
||
# Contrast Streching and histogtram streching | ||
|
||
|
||
|
||
|
||
<img src="./A1_resources/A1_resources/hist_equal2.jpg" /> |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import numpy as np | ||
import cv2 | ||
|
||
cv2.imread('./rose.jpeg') | ||
|
||
|
||
# def top_k_color(im,k): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,253 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
struct node{ | ||
struct node* left; | ||
struct node* right; | ||
int key; | ||
int h; | ||
}; | ||
|
||
int max(int a,int b) | ||
{ | ||
return a>b?a:b; | ||
} | ||
|
||
int height(struct node* a) | ||
{ | ||
if(a==NULL) | ||
return 0; | ||
else | ||
return a->h; | ||
} | ||
|
||
struct node* clock(struct node* root) | ||
{ | ||
struct node* child=root->left; | ||
struct node* subtree=root->left->right; | ||
|
||
root->left=subtree; | ||
child->right=root; | ||
|
||
|
||
root->h=max(height(root->left),height(root->right))+1; | ||
child->h=max(height(child->left),height(child->right))+1; | ||
|
||
|
||
return child; | ||
} | ||
|
||
|
||
struct node* aclock(struct node* root) | ||
{ | ||
struct node* child=root->right; | ||
struct node* subtree=root->right->left; | ||
|
||
root->right=subtree; | ||
child->left=root; | ||
|
||
root->h=max(height(root->left),height(root->right))+1; | ||
child->h=max(height(child->left),height(child->right))+1; | ||
|
||
return child; | ||
} | ||
|
||
|
||
void print(struct node* root) | ||
{ | ||
if(root==NULL) | ||
return; | ||
|
||
print(root->left); | ||
|
||
printf("val::%d heigh:%d\n",root->key,height(root)); | ||
|
||
print(root->right); | ||
|
||
} | ||
|
||
|
||
//insert | ||
struct node* insert(struct node* root,int t) | ||
{ | ||
|
||
if(root==NULL) | ||
{ | ||
struct node* newnode=(struct node*)malloc(sizeof(struct node)); | ||
newnode->right=NULL; | ||
newnode->left=NULL; | ||
newnode->key=t; | ||
newnode->h=1; | ||
return root=newnode; | ||
} | ||
|
||
|
||
if(root->key >= t) | ||
root->left=insert(root->left,t); | ||
|
||
else if(root->key < t) | ||
root->right=insert(root->right,t); | ||
|
||
// printf("check root:%d\n",root->key); | ||
// print(root->left); | ||
// print(root->right); | ||
|
||
// printf("\n"); | ||
|
||
if(height(root->left) > height(root->right) + 1) | ||
{ | ||
|
||
if(height(root->left->left) < height(root->left->right)) | ||
root->left=aclock(root->left); | ||
|
||
root=clock(root); | ||
} | ||
|
||
else if(height(root->right) > height(root->left) + 1) | ||
{ | ||
if(height(root->right->right) < height(root->right->left)) | ||
root->right=clock(root->right); | ||
|
||
root=aclock(root); | ||
} | ||
|
||
root->h=max(height(root->left),height(root->right))+1; | ||
// printf("height::%d\n",root->h); | ||
|
||
return root; | ||
|
||
} | ||
|
||
struct node* delnode(struct node* root,struct node* head) | ||
{ | ||
if(root->left==NULL) | ||
{ | ||
head->key=root->key; | ||
|
||
|
||
if(root->right!=NULL) | ||
return root->right; | ||
else | ||
return NULL; | ||
} | ||
|
||
root->left=delnode(root->left,head); | ||
|
||
if(height(root->left) > height(root->right) + 1) | ||
{ | ||
|
||
if(height(root->left->left) < height(root->left->right)) | ||
root->left=aclock(root->left); | ||
|
||
root=clock(root); | ||
} | ||
|
||
else if(height(root->right) > height(root->left) + 1) | ||
{ | ||
if(height(root->right->right) < height(root->right->left)) | ||
root->right=clock(root->right); | ||
|
||
root=aclock(root); | ||
} | ||
|
||
root->h=max(height(root->left),height(root->right))+1; | ||
// printf("height::%d\n",root->h); | ||
|
||
|
||
|
||
return root; | ||
|
||
} | ||
|
||
struct node* del(struct node* root,int val) | ||
{ | ||
if(root==NULL) | ||
{printf("Nothing to delete\n");return root;} | ||
|
||
if(root->key > val) | ||
root->left=del(root->left,val); | ||
else if(root->key < val) | ||
root->right=del(root->right,val); | ||
|
||
else | ||
{ | ||
printf("here\n"); | ||
if(root->left==NULL&&root->right==NULL) | ||
return root=NULL; | ||
|
||
else if(root->left==NULL) | ||
root=root->right; | ||
|
||
else if(root->right==NULL) | ||
root=root->left; | ||
else | ||
root=delnode(root,root); | ||
|
||
} | ||
|
||
|
||
|
||
if(height(root->left) > height(root->right) + 1) | ||
{ | ||
|
||
if(height(root->left->left) < height(root->left->right)) | ||
root->left=aclock(root->left); | ||
|
||
root=clock(root); | ||
} | ||
|
||
else if(height(root->right) > height(root->left) + 1) | ||
{ | ||
if(height(root->right->right) < height(root->right->left)) | ||
root->right=clock(root->right); | ||
|
||
root=aclock(root); | ||
} | ||
|
||
root->h=max(height(root->left),height(root->right))+1; | ||
// printf("height::%d\n",root->h); | ||
|
||
return root; | ||
|
||
} | ||
|
||
|
||
//search | ||
|
||
int main() | ||
{ | ||
struct node* head = NULL; | ||
|
||
|
||
int t=0; | ||
while(t!=-1) | ||
{ | ||
scanf("%d",&t); | ||
|
||
if(t==-1) | ||
break; | ||
|
||
head=insert(head,t); | ||
|
||
print(head); | ||
|
||
} | ||
|
||
t=0; | ||
while(t!=-1) | ||
{ | ||
scanf("%d",&t); | ||
|
||
if(t==-1) | ||
break; | ||
|
||
head=del(head,t); | ||
|
||
print(head); | ||
|
||
} | ||
|
||
|
||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include<bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
typedef pair<int,int> II; | ||
typedef vector< II > VII; | ||
typedef vector<int> VI; | ||
typedef vector< VI > VVI; | ||
typedef long long int LL; | ||
|
||
#define PB push_back | ||
#define MP make_pair | ||
#define F first | ||
#define S second | ||
#define SZ(a) (int)(a.size()) | ||
#define ALL(a) a.begin(),a.end() | ||
#define SET(a,b) memset(a,b,sizeof(a)) | ||
|
||
#define si(n) scanf("%d",&n) | ||
#define dout(n) printf("%d\n",n) | ||
#define sll(n) scanf("%lld",&n) | ||
#define lldout(n) printf("%lld\n",n) | ||
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL) | ||
|
||
#define TRACE | ||
|
||
#ifdef TRACE | ||
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) | ||
template <typename Arg1> | ||
void __f(const char* name, Arg1&& arg1){ | ||
cerr << name << " : " << arg1 << std::endl; | ||
} | ||
template <typename Arg1, typename... Args> | ||
void __f(const char* names, Arg1&& arg1, Args&&... args){ | ||
const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); | ||
} | ||
#else | ||
#define trace(...) | ||
#endif | ||
|
||
//FILE *fin = freopen("in","r",stdin); | ||
//FILE *fout = freopen("out","w",stdout); | ||
|
||
const int N = int(1e5)+10; | ||
|
||
VI G[N]; | ||
int BIT[N],A[N]; | ||
|
||
int sum(int x) | ||
{ | ||
int ret=0; | ||
while(x) | ||
{ | ||
ret ^= BIT[x]; | ||
x -= x&(-x); | ||
} | ||
return ret; | ||
} | ||
|
||
void update(int x, int val) // add val to A[x] | ||
{ | ||
while(x < N) | ||
{ | ||
BIT[x] ^= val; | ||
x += x&(-x); | ||
} | ||
} | ||
|
||
int query(int l, int r) | ||
{ | ||
return sum(r)^sum(l-1); | ||
} | ||
|
||
int main() | ||
{ | ||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.