• Content count

  • Joined

  • Last visited

Community Reputation

-3 Poor

1 Follower

About sjhalayka

  • Rank

Personal Information

  • Interests
  1. OpenCV

    I updated the code to detect the edges in the H channel from an HSV version of the input image. This works better than the original code, which detected the edges in the grayscale version of the input image. Edges can also be detected in the S and V channels; no point in throwing away good input data; the V channel is like the grayscale version of the input image. Looking into more complicated obstacle detectors; machine learning (already found code to do the XOR operation using a feed-forward back-propagation artificial neural network -- the equivalent of Hello World LOL).
  2. OpenCV

    The code is posted at: ... it uses the AVI reading code from the book Learning OpenCV 3. Some test AVIs are included in the repository at: Thanks for the insight.
  3. OpenCV

    Thanks all. I am getting Learning OpenCV 3.0 as a gift. Ok what I want is to do an edge detection, then convert all gray pixels to white or black, depending- on the darkness of the gray. Then I want to do is draw a white bitmap to the entire screen, then draw the black edge pixels then do a fill that doesn’t permeate the black. I should end up with a fill, and some white regions where the obstacles are. Is it possible to do this in OpenCV? I know that it does edge detection. So far I found this:
  4. OpenCV

    I'm basically wanting to write an app that detects dynamic obstacles.
  5. OpenCV

    Does anyone have experience with OpenCV? Did you buy any books? Were they helpful?
  6. Blind Poker Artificial Neural Network

    That's a good idea, but I promised someone that I'd write a guest post on their blog about the game's innards once it's all finished. I promise not to post here too often, in the forums.
  7. Blind Poker Artificial Neural Network

    In order to play the game, the computer player needs to know what the best possible rank (Royal Flush, etc) their current hand can make. Cards in one's hand that are still not shown are treated as wild cards. Only cards that are currently not shown on the entire table are used to make the best possible rank. Once the best possible rank is obtained, one then temporarily takes a card from either the discard or pickup pile and runs that hand through the best possible rank function. If this temporary rank is less than the best possible rank, the card is not taken on a permanent basis. This is not perfect, but it does the trick far better than a computer player who choses the discard pile or pickup pile cards pseudorandomly.
  8. Blind Poker Artificial Neural Network

    I updated the code to include one-hot encoding, using a #define.
  9. Blind Poker Artificial Neural Network

    So I took a couple of days off and went the ANN route. The code is up at: I play 1 pseudorandom computer player versus 4 ANNs, for 5 players altogether. No training is needed for the player who wins. It's when the ANN loses that its choices are negated (e.g. if(0 == floor(value + 0.5)) { value = 1; } else { value = 0; } ) and fed into the back propagation function. Seeing how the error rate settles down to some constant number, only the maximum number of training sessions is what's used to terminate the learning process. For 4 players to 2 players, I play 3 to 1 ANNs. Altogether, for 2 players, 3 players, 4 players, and 5 players, there are 10 ANNs. ... now back to the hard-coded AI.
  10. Blind Poker Artificial Neural Network

    There's also knowledge to be gained by considering the plays of any loser; not just when you lose.
  11. random selection of array elements

    How do you do black background code snippets?
  12. random selection of array elements

    Thank you Kylotan. I'll change the source code.
  13. random selection of array elements

    A memory intensive way to go about it is: #include <iostream> #include <vector> #include <algorithm> using namespace std; #include <cstdlib> int main(void) { vector<long unsigned int> numbers; for(size_t i = 0; i < 1000; i++) numbers.push_back(1000); for(size_t i = 0; i < 800; i++) numbers.push_back(800); for(size_t i = 0; i < 400; i++) numbers.push_back(400); for(size_t i = 0; i < 200; i++) numbers.push_back(200); if(numbers.size() > RAND_MAX) { cout << "Need a better PRNG" << endl; return 0; } long unsigned int pseudo_random_number = numbers[rand() % numbers.size()]; cout << pseudo_random_number << endl; return 1; }
  14. Blind Poker Artificial Neural Network

    There's knowledge to be gained by considering the plays of any winner; not just when you win.
  15. Blind Poker Artificial Neural Network

    size_t rank_hand(const size_t player_index) const { if(player_index >= NUM_PLAYERS) return 0; size_t ret = 0; vector<card> temp_hand = players_hands[player_index]; sort(temp_hand.begin(), temp_hand.end()); // Note: FACE_A is defined to be 12 size_t offset = FACE_A + 1; for(size_t i = 0; i < NUM_CARDS_PER_HAND; i++) { ret += temp_hand[i].face * offset; offset *= FACE_A + 1; } return ret; }